Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
This repository was archived by the owner on May 30, 2024. It is now read-only.

Allow lazily computed defaultValues in LDClient to improve code readability #284

Closed
@swar8080

Description

@swar8080

Is your feature request related to a problem? Please describe.

When using the LDCLient, it'd be nice if the code could always read as:

  • "get this feature flag value from launchdarkly, or fallback to defaultValue"

However, when the defaultValue takes multiple lines to compute, it reads as something like:

  • "here's some default feature value for some flag I haven't read yet"
  • "now it's getting a flag value from LaunchDarkly, and it's falling back to the default value computed above"

It's less readable because the code is read in reverse order of its logic

Describe the solution you'd like
Code and logic are in the same order, using overloaded methods on LDClient methods (for boolean, int, and double) like:

EvaluationDetail<Boolean> boolVariationDetail(String featureKey, LDUser user, Supplier<Boolean> defaultValueSupplier)

Happy to create a MR for this if you agree it's worth adding

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions