Feature Flags

Feature Flags are hardcoded conditional statements that enable developers to turn features of their software on or off. They allow for more granular control over the features that are available in a live environment.

Purpose

Feature flags let developers commit work in progress code to the main branch, while keeping it hidden from users. This minimises the risk of each commit, reduces merge hell and lets developers decouple their work from other developers.

Feature Flag Maturity

Feature flags refer to the first two stages of the feature flag maturity model. At higher levels the feature flags become feature toggles.

Maturity LevelImplementation DescriptionTools/Approaches
BasicSimple if-else statements directly in the code. This approach is quick to implement but can become hard to manage as the number of flags grows.Native code, no specific tools.
IntermediateFeature flags are centralised in a configuration file or a database. This allows easier management compared to the basic level but lacks advanced targeting and analysis.Configuration files, custom databases.
AdvancedUtilisation of a dedicated feature flag service or platform that offers targeting, canary releases, and A/B testing capabilities.LaunchDarkly, Split.io, Unleash, Optimisely.
EnterpriseAdvanced systems with additional features such as real-time flag updates, full user targeting, percentage rollouts, experiment tracking, and comprehensive analytics.LaunchDarkly, Split.io, with custom integrations and extensive analytics platforms.

Anti-patterns

  • Overuse: Using feature flags for every new feature can lead to a cluttered codebase.
  • Long-lived Flags: Keeping feature flags in the code for too long after their purpose is fulfilled.

Was this page helpful?

Previous
Unvalidated Code
© ZeroBlockers, 2024. All rights reserved.