Feature Flags / Feature Toggles

Author
Photo of Sohrab Salimi
Sohrab Salimi

Reading time
3 Minutes

In software development, feature flagging refers to the switching on and off of software functions or features under development at runtime.

Feature flags thus describe a programming technique that enables you and your team to deliver software even faster and more securely and to integrate it across teams. Since a time-independent deployment of applications is an increasingly common requirement, feature flags offer a suitable solution for this. In addition, the flags help to optimize the workflows of a developer team.

Synonymously used terms for Feature Flags and Feature Flagging are:

  • Feature Toggles / Feature Toggling
  • Feature Switches
  • Feature Flippers
  • Feature Bits
  • Conditional Features (in connection with User Targeting)

Goals and benefits of Feature Flags in detail

Thanks to Feature Flags, you and your team can:

  • Deploy software and roll out new features to customers faster and more gradually (Continuous Integration and Continuous Delivery become faster and easier)
  • Integrate new features across teams
  • Test new requirements in a productive environment (without customers noticing)
  • Release already developed features only to specific user groups
  • Gradually [improve functionality and UX] through regular testing (/en/agile-leader/teresa-torres-continuous-discovery-habits/ "Continuous Discovery Habits")
  • Keep applications stable in operation by disabling buggy features
  • Minimize time-consuming bug fix deployments
  • Decouple software releases and deployment of applications from each other
  • Avoid large and risky deployments by merging more often with the main branch instead of rarely merging long feature branches.
    react flexibly to changes in customer requirements without additional deployments

When and how are feature flags applied?

In practice, features that have already been developed are often left undeveloped because they are not yet allowed to be used productively. The respective feature branches may then not yet be flagged.

Thanks to Feature Toggles / Flags, finalized code can be merged and deployed immediately, so that the new features are already available in the background without being visible. This prevents massive problems when merging later, if work has continued on other parts of the software in the meantime.

The use of feature flags is also worthwhile in the following use cases:

  • Continuous Integration and Continuous Delivery (CI / CD).
  • Kill Switch
  • A/B Testing with customers in production environment
  • Configuration management
  • Authorization control in the application
  • Percentage rollout of features

There are 3 ways to implement feature flags:

  1. Implement feature toggles directly in the code
  2. Integration via a configuration file (config)
  3. Integration via feature flag management software

Tips:

To keep code complexity as low as possible, you and your team should:

  • Use feature flags as sparingly as possible
  • Remove flags that are no longer used from the software lifecycle

4 Types of Feature Flags

Depending on how long feature flags should remain in the code and what their purpose is, they can be divided into the following 4 categories:

Release Toggle

Release toggles allow code deployment of untested and incomplete code to the production environment without activating the code. This allows product managers, for example, to release new features as needed.

Experiment Toggle

Experiment toggles can be used to control user-specific behavior within an application. To this end, users are identified within the software system so that they can then be specifically controlled. In this way, new functions can be quickly tested on specific groups of people so that conclusions can be drawn for further development.

Ops Toggle

Ops Toggles allow operations teams to control application operations via feature toggles. This enables quick rollbacks of features and testing the workload of new features on small groups. In addition, Ops Toggles allow functions that are not required to be disabled during operation ("kill switches").

Permission Toggle

Permission toggles can be used to control the user-specific behavior of known users within an application. For example, you can use these toggles to enable functions for VIP or premium customers. A/B tests are another possible application.

Summary on Feature Toggles / Flags

Feature toggles or flags support teams in delivering, integrating and testing new functions and features faster and easier.

Different toggle types serve different purposes, such as testing new features on small groups, enabling specific permissions, or checking system load. Feature flags and toggles can show or hide entire areas of software or control only small blocks of code. Since they can be used on the backend, frontend and application-wide, they can be used flexibly.

Important: As soon as feature flags are no longer needed in the code, you or your team should remove them. In this way, you prevent the code from becoming too complex.

Related articles

Lean Development

Lean-Development or lean software development methods concentrate on the elimination of waste. You work with short feedback loops and frequent testing.

Velocity in Scrum – Definition and how you can calculate it

The Velocity is a Scrum metric, that helps you to find the right amount of work for each sprint for the Scrum Team. We explain how to calculate it!

Mission & Vision: Differences and Similarities

Why should you form a company vision and mission and where are the differneces? We answer your questions in our knowledge area at Agile Academy.