Software Release Glossary
Most commonly used terms and acronyms by product managers, engineers and devops, regarding deployment strategies
BCDFKPRST

Feature Toggle

Sometimes, we hear the term feature toggles and other times, we hear the term feature flags. So, the question is, are they one and the same or is there really a difference?

In his article, Martin Fowler, refers to feature toggles more often but he does admit to using feature flags and feature toggles interchangeably, claiming that they ultimately refer to the same technique.

Definition

Fowler defines feature toggles as a set of patterns that helps developers deliver new functionality to users quickly and safely. They allow developers to toggle features on and off for users for testing in production resulting in complete control of the release process.

A feature toggle or flag in your code is essentially an if-statement. The code inside these statements can be toggled on or off accordingly.

So you would basically have a configuration file that defines toggles for your pending features that are ready to be released: Any unfinished features can be toggled off so that they don’t appear in the user interface.

This allows developers to release their changes in small batches without the need for branching and merging, thereby speeding up the software development process and allowing for quicker releases of your features.

A breakdown of toggles

Here, we will introduce a few key terms that illustrate how a feature flag/toggle is developed:

  • Toggle point: this is where the toggle decision is made.
  • Toggle router: this determines the state of the flag in a dynamic way, used to route users to different implementations of the codebase so that the users chosen can be directed towards the new feature. There are many ways to implement this router from simple in-memory store to a sophisticated distributed system.
  • Toggle context: used as a proxy to identify the user making the request such as the date, geolocation of the user, etc.
  • Toggle configuration: when the time comes to release, the toggle router for features will make decisions based on your toggle configuration, usually environment-specific.

Additionally, a feature toggle or flag should have a unique name that differentiates it from the other flags in the system. Then, you will define targeting rules for these toggles where you set up targeting keys where only users matching this key value will be able to see your feature.

Feature flags vs feature toggles

As developers began to fully understand the true value behind feature toggles, they capitalized on their many benefits by implementing them across a variety of use-cases.

Therefore, feature toggles evolved from a simple switch to turn features on and off to a way to manage features from their development until they are eventually disabled via a kill switch. This resulted in many organizations using feature flag management systems to apply such complex, more advanced use-cases.

When we think of a feature toggle, we imagine a switch to turn or toggle features on and off but due to the evolving use-cases, we may use the term feature flags to more adequately describe these uses. Thus, feature flag is a more appropriate term if a decision point is followed by a very multi-conditional or broad set of codepaths.

News
Flagship by AB Tasty recognized as a leader in The Forrester New Wave: Feature Management And Experimentation, Q2 2021

Benefits of feature toggles

Undoubtedly, feature toggles’ (or feature flags) have become an integral component to ensure continuous delivery of software while mitigating risks during the software development and release processes.

Any new release comes with a margin of risk and so any changes made to the software are put behind a feature toggle, allowing you to turn them on to test in production or off in case of an emergency, such as a bug detected.

In that sense, feature toggles allow changes to be released to a small subset of users for instant feedback before rolling out these changes to everyone else. This permits immediate rollbacks if something goes wrong while the issue is analyzed and fixed.

Feature toggles also enable continuous integration with the added advantage and flexibility of choosing which features will be available and which will be hidden. This naturally leads to continuous deployment and continuous delivery as you can now release more frequently even if not all changes are ready.

Beware of debt

Despite the many benefits of feature toggles, one must remain vigilant about the rise of technical debt. There are certain types of short-lived toggles that serve a one-time purpose that should be eliminated from your system once they have served their purpose. 

To avoid this build-up of technical debt, you should consider the possibility of investing in a feature flag management system like Flagship by AB Tasty that could keep track of all your flags to see where they are and when they were last used.

To conclude

Whatever you decide to call them, feature toggles or feature flags are a powerful tool to have at your disposal during your software development process. They allow you to safely test and experiment with your features without any of the risks associated with big-bang releases. With such tools, you are in complete control of your releases.

To find out more, click here for our definitive guide to feature flags.

More terms from the glossary
DevOps Engineer

A DevOps engineer is an IT professional who oversees the release of new code and facilitates collaboration between development and operation teams for increased productivity.

Read description
CI/CD Pipeline

A CI/CD pipeline is a series of steps which automates the software delivery process allowing releases to be delivered rapidly and efficiently.

Read description
Blue-Green Deployment

Blue-green deployment is a strategy that uses two production environments where traffic is directed to one of these environments once changes are ready.

Read description
crossmenu
Copy link