Feature flags are being called one of the next big things in development, and for good reason. Not only are they a key to a true continuous delivery cycle, they can remove the anxiety from a high-stakes release, enable developers to ship new features with confidence and allow for the incremental release of features to test their impact. It’s no wonder, then, that a Forrester survey found 31% of teams said feature management is critical to their software development initiatives. What’s more, the latest report from Google’s DORA team shows elite performers–those using trunk-based development, including feature flags–deploy 973 times more frequently.
In the world of feature management, release feature flags—also known as feature toggles—are one of the most predominantly used. Release feature flags separate a new feature release from deployment and ensure continuous delivery of code. They can be used to ship incomplete code, control the rollout of releases, merge incomplete code into your main branch without interfering with your test or release process, and release whenever you’re ready.
Here’s how release feature flags can be applied in three different scenarios:
- Shipping Incomplete Code To Production
Release feature flags allow you to ship incomplete, untested, or otherwise unready code to production without needing to turn them on. Because of this, feature flags are an effective way to reduce the number of times you need to deploy new code to production.
When you are looking to make continuous updates, you want a strategy rooted in continuous integration and deployment (CI/CD). Feature flags can be used to continuously validate your changes on a subset of users. This use-case allows you to release features faster and more confidently, while minimizing risk.
You get faster releases, higher-quality features and minimize the risk of bugs. With feature flags, you can deploy new versions through CI/CD. As you’re ready, you can turn on the new features without pushing an update to production, making it easier for you to roll out changes such as bug fixes or new features.
- Control Feature Release and Rollouts
Feature flags bring great efficiency to the release of new features, enabling features to be released both rapidly and safely. Implementing release flags is a best practice that allows product managers to control the release and rollout of a feature on their own schedules. It also allows software development teams or other stakeholders, such as product and marketing teams, to set up a release schedule ahead of time.
Once your feature is ready, you can directly test it in production. You can target your feature to be visible to only internal users, the users who use it the most, QA testers, or beta customers. It’s also possible to target a feature to internal teams, by location, or any custom attribute.
A critical developer habit is to get feedback from your customers before releasing a new feature to your entire user base, as well as to control whether a subset of users can use the feature. You can then assess performance based on the chosen KPIs, while avoiding any risk of damage from a buggy feature being shown to all your users.
With a percentage rollout, you release a new feature to only a portion of the user base and then gradually roll it out to more users. You can then decide how large a percentage of your entire customer base you want to release the new feature to. You can also decide what percentage of those users will receive it at first, and then roll it out to others over time.
- Speed up How You Merge Into Your Main Branch
Release feature flags make it possible to merge incomplete code into main branches without interfering with testing or a continuous release process. This methodology is an integral part of trunk-based development, a development style where several developers work in isolation on small batches of code and then merge their work into the trunk once or even several times a day. In trunk-based development, code is pushed directly to the trunk, which enables greater version control and helps teams avoid the “merge hell” that’s more common with the Gitflow (AKA feature branch development) model.
With Gitflow, there are more branches and larger commits. Every developer gets their own branch and they merge it into the main trunk when they’re done. Not only is it more difficult to merge these long-lived branches together, there’s inevitably conflict because teams are blind to the changes that others are making and could affect them.
Release feature flags, particularly when used with trunk-based development, vastly increase the speed and safety of developing and releasing new features and lends well to continuous delivery. Because feature flags can be turned on and off at any second, code can be pushed safely to production, even if it’s not complete, which greatly speeds cycle time. These types of feature flags also allow for gradual releases, so code can be tested with partial groups of users to gauge its impact before it’s executed to everyone.
With the ability of release feature flags to help you ship more and worry less, they are becoming an integral part of every developer’s toolkit, and the key to a safe and successful continuous delivery cycle. Expect release feature flags to continue to change the face of software development and delivery in the coming years.