Feature Flags (or Toggles) are essentially new features that are wrapped if/else statements, in code, that can be used to determine if a feature, at runtime, should be shown or hidden for end users.
Feature toggles are a powerful technique, allowing teams to modify system behavior without changing code.
However, they offer much, much more than the if/else statement would have it seem at first glance.
Projects that have Continuous Delivery - short release cycles - may have a lot of time and effort going into releasing code. Time and effort that greatly adds up with each release cycle:
- Branch and/or merge the code.
- Test a version of the code.
- Prepare the users for a version of the code.
- Deploy a version of the code that releases a bunch of new features on the users.
In terms of the end users, this approach is backwards. It is code-centric rather than feature-centric. Users don’t understand these reasons or the code itself. Features are what matter to end users and, more specifically, how those features are released to them.
Therein lies the power of Feature Flags.
Feature Flags allow you to decouple your feature deployments from your code deployments.
With your new features wrapped in feature flags, continue to develop and release code (no need for feature branching). When it comes time to release a version of the code, there is less of a risk and less of an impact to your end users because the act of releasing code is not directly tied to a release of new, potentially unstable, features - features that carry a functional and/or technical risk.
Following deployment, you can use a feature flags service or application, such as Feature Ops to toggle features on or off at your own choosing. Perhaps you do so incrementally (I.e. 50% of the users) or with group targets (I.e. specific users) or for experimental purposes.
With feature flags (toggles), you are in control of rolling out and/or rolling back features thereby decoupling the feature deployments from the code deployments. This leads to less time, effort, and risk when it comes to deployments, and feature branching and merging.