Why Feature Flags?

You may have heard of a feature flag (also known as a feature toggle or feature switch), but chances are that you don’t really know their full capabilities. In their most basic sense, feature flags refer to a decision structure surrounding a feature or functionality in your code. This decision structure allows you to adjust how your application or website behaves without having to redeploy your code.

When used correctly, feature flags have a variety of purposes, a few of which include internal review of features, enabling site maintenance, and other types of testing.

Internal Review of Features

Feature flags are an excellent way of facilitating testing by your QA team without disrupting either software development or user experience. The new features can be limited to internal users only until the development team decides they are ready to go live. Such flags also support feature experimentation ranging from major overhauls of the entire system to a minor update to the UI. That means features and the impact they have on other parts of the code can be thoroughly investigated before they ever go live.

Trial of New Features

Feature toggles serve as a straightforward yet effective means of performing A/B testing or split testing of features and functionality. User based feature flags allow a feature to be available to a subset of customers in order to understand how they respond to a feature.

These flags allow the development team to perform focused customer analysis, investigating the effects of a new feature and gathering data about how customers use and respond to changes in functionality. Feature toggles and flags support feature experimentation by allowing new features to be switched on and off without disrupting the overall user experience.

Another interesting use of feature flags is performing a canary release, where the feature in question is turned on for only a small percentage of the users. If they have trouble with the feature, it also acts as a kill switch for disabling it.

Trunk Based Development

Trunk based development is essential for continuous delivery. Feature flagging supports trunk based development by wrapping functionality and components in flags. This helps to preserve the integrity of your platform by allowing you to rollback any code that is causing problems, making code deployment a little less painful.

Feature Flags to Enable Site Maintenance

You might have noticed that it is becoming more and more rare for a system to announce that it must be shut down for maintenance at a certain time. This is thanks to feature switches, which support turning off certain features or functionality while maintenance is being performed. If you discover a feature that is not working correctly, they act as an effective kill switch.

Other Examples of Implementing Feature Flags

Suppose you would like to allow users to try premium access to your website or application for a week — this can be accomplished using a feature flag that limits access only to certain users. Feature flags make it much easier to perform a beta test, restricting certain aspects of functionality to users who have agreed to use the beta version. They can also be used as placeholders in the code for features that are still in development but not quite ready for release.

Wrapping Up

Feature flags can be used for so many different things throughout the lifecycle of an application. They can be used to support key aspects of development such as internal review and trunk development. Once an application has been deployed, feature flags can assist with maintenance, support testing, and canary released.

There are feature flag best practices for just about any industry or application type. If you are interested in releasing and testing features in a secure way that also provides critical customer metrics, then try feature flags for free with Split.