Most Agile development teams use a familiar continuous integration and deployment (CI/CD) process. When developing a new feature, they create a new branch in source control, create a pull request when ready and merge the pull request into a staging or production environment when it passes all of the required unit and integration tests.
In December of 2009, Flickr announced that it used a code repository without branches and checked everything into head before pushing to production several times a day. The development team did this through the use of feature flags—a novel idea at the time that involved toggling features and deploying them to subsets of users.
Let’s take a look at why you might want to gradually rollout new features, how feature flags can help you do it and some best practices to keep in mind.
Feature flags enable you to gradually rollout new features to beta users without the need for separate branches and servers. Click To TweetWhy Gradually Rollout New Features?
Feature rollouts introduce a new feature to a subset of users rather than every user. For example, you might deploy a feature to beta users that are willing to accept the cutting-edge features that are a little rough around the edges. If something goes wrong, the feature can be quickly switched off without the need to redeploy code.
There are many reasons to release features in this way:
- Development teams can determine if there are any defects in a production environment, as well as ensure that a feature scales properly.
- Product managers can introduce beta features to a select number of users to get their feedback before deploying it across the system.
- Customer support teams can roll out features early to the most affected customers to help solve critical problems rather than waiting on a full release.
- Marketing teams can run A/B tests to see how features resonate with customers or how different versions of the same feature compare.
Modern tools also make it easy to gradually rollout new features without introducing a lot of complexity or overhead. With simple commercial or open-source tools, you can implement feature toggles with a matter of hours to realize these benefits and potentially improve your Agile software development workflows.
How It Works on a Technical Level
Feature flags are the most popular way to gradually rollout new features. Rather than maintaining separate feature branches, feature flags are code-based switches that enable features to be toggled on or off via a dashboard. Product managers, customer support teams or others can easily sign in and make the changes as needed.
Amoeboids-Announce-New-FeaturesUnleash’s Feature Flag Dashboard – Source: Unleash
Feature flags are typically implemented using a trivial piece of code:
“`
if (unleash.isEnabled(“AwesomeFeature”)) {
// do something
} else {
// do something else
}
“`
There are many different commercial and open-source tools to implement feature flags. For example, Unleash is a popular open-source tool that supports a wide variety of programming languages. Development teams can easily implement feature toggles and different variants of a given feature to control which users have access to them.
Other popular feature flag tools include:
Best Practices to Keep in Mind
Feature flags are a great way to release new features to a subset of users in order to ensure that they work before widely deploying them. When using feature flags, there are several best practices to keep in mind to realize the benefits and avoid potential pitfalls. Development teams should keep these tips in mind when implementing their feature rollout strategies.
Some important best practices include:
- Use Canary Releases. Canary releases are small percentages of the total user base that are randomly selected. By randomizing the cohort, you can avoid releasing incomplete features to the same users and ensure a consistent experience.
- Decouple the Logic. Decision points should be decoupled from decision logic within code. Oftentimes, this means extracting feature flags into their own functions or concerns to make them easier to manage over the long run.
- Centralize Configuration. Ensure that feature flag configuration elements are easily accessible in a centralized location, such as a YAML file that’s in source control. You may also want to include the creator and expiration date for the features.
- Diligently Maintain. Feature flags introduce carrying costs since they introduce conditional logic and abstractions into the code base. When using them, it’s important to refactor frequently to minimize these costs.
There are also some unavoidable pitfalls to keep in mind. For instance, integration tests will naturally become more complex if they need to test multiple different paths due to the existence of feature flags. If testing resources are limited, you may need to focus integration testing efforts on feature flags that are likely to enter production.
Communicating with Different Users
Gradual feature rollouts complicate the process of creating release notes since different users will see different features. While many companies revert to generic release notes for users, a better alternative is customizing release notes for different audiences. Automated Release Notes for Jira simplifies the process through automation.
Automated Release Notes for Jira – Source: Amoeboids
For example, you may want to tag new features in Jira to indicate that they are only available to beta users. When the new features are deployed and toggled on for beta users, you can trigger an email release note template to fire off to those users to keep them in the loop. The same is true for features geared towards internal audiences or the entire user base.
In addition to release notes, you may want to provide beta users with an easy way to provide feedback on toggled features. Roadmap Portal for JSD simplifies the process by integrating with Jira Service Desk to provide select customers with access to a public roadmap where they can leave features for product managers to review.
The Bottom Line
Gradual feature rollouts enable development teams to dip their toes in the water before committing to a full feature rollout. Rather than maintaining different branches, feature flags and related techniques enable teams to launch new features and see how they function with a small subset of real users before committing to a full deployment.
If you use Atlassian, check out our full suite of Atlassian apps designed to help simplify development by automating and streamlining certain tasks.