DEV Community

Discussion on: Safe .NET Feature Flags with FeatureToggle

Collapse
seangwright profile image
Sean G. Wright

Cool! This seems like a good overview of how this library works.

I like Jason Roberts' content on Pluralsight and he seems to have made a real pragmatic library here.

One way I've avoided "scattered strings" used for config is to use the nameof() operator.

public class Config
{
  public const string NEW_DASHBOARD_FEATURE = nameof(NEW_DASHBOARD_FEATURE);
}

This helps keep the value directly tied to the field.


I still have reservations about using a concretion directly, especially a volatile one (it depends on environment specific config) that is new'd up outside the composition root.

This complicates unit testing, effectively requiring integration tests for this section of code.

That said, direct access to feature state/status is easier to understand and requires less architecture.

👍