Feature flags streamline software development by allowing controlled, incremental feature releases without redeploying code. They improve testing, minimize risks, and enable feedback-driven development, enhancing flexibility for teams across development, marketing, and support.
A feature flag enables users to change a running application’s functionality without deploying new code. By using feature flags, you can hide code or behaviors without having to ship new versions of the software. This not only streamlines software development but also enhances the user experience by ensuring that users only interact with features that are ready and optimized. You can imagine a feature flag like a powerful if statement.
if(HarnessFeatureFlag["newamazingfeature"] == true) {
renderNewAmazingFeature();
}
In simple words, a feature flag is a decision point in your code that can change the behavior of your software.
In the software industry, feature flags go by different names (to list a few):
Like someone wisely said, “What’s in a name?” The purpose is to control how code is shipped or deployed.
Feature flags support both simple and complex scenarios. You can use Boolean or Multivariate flags for your applications, depending on your requirements. To add more power to feature flags, you can add custom rules and variations to your flags. You can also create targets to control which user sees the variation of a feature flag. A target can be any attribute that can be uniquely identified with an entity. For example, an application, systems, services, machines, resources uniquely identified by an IP address, email ID, user ID, etc.
Targets can be used to add users for internal testing or beta programs before a broader rollout.
A Boolean flag typically has two variations: true or false.
Multivariate flags allow you to serve multiple variations of a feature to different user segments simultaneously. There is no limit to the number of variations that you can add to a multivariate flag, making it useful for complex use cases and to manage two or more variations of a feature. Multivariate flags have multiple settings that allow you to define different variations using strings, numbers, and JSON.
As per the research conducted by DevOps Research and Assessment (DORA) and Google Cloud, organizations across industries continue to improve their DevOps expertise, particularly among the highest performers. The proportion of elite performers has almost tripled, now at 20% of all organizations.
This data indicates that having a CI/CD pipeline has become almost necessary to increase the velocity of code deployments. However, this fast pace also exposes your features/code to new kinds of potential risks. So, it becomes equally important to have certain guards in place to mitigate the risks and to gate the feature. Features flags are nothing but one of those safety guards to move quickly, but safely. Because, with feature flags, you can turn on or off a feature in a production environment without rolling back the code.
Let’s try to understand where you can use feature flags using a couple of examples:
Say you want to roll out a feature internally only to the Product Management group before rolling it out to anyone else in the organization or outside the organization. Not to worry, feature flags are there at your rescue! You can control the access of this feature using a feature flag.
Create a feature flag with a rule that employees logged into the application with [email protected] and [email protected] email addresses will see the feature; other users will not.
Feature flags eliminate the need of maintaining multiple branches within your source code. You can commit all the changes to your main branch, and control the access using the power of the feature flag.
Here is another example that elaborates on the use case of a feature flag:
A team is working on developing a new feature. As software development is an incremental process, developers build the feature incrementally and merge the code to the main branch multiple times in a day. All the code is getting committed to the source code. The important thing to note here is that the feature is still not fully complete and ready to be released to the customers. In such a scenario, the feature flags can be your best buddy.
You can introduce a feature flag into your application and keep the new feature (which is under development) hidden until they are ready to be released. You do not need to worry about anything even if the changes are getting deployed to production daily/weekly (depending on the release cycle in your organization).
You can control the visibility of new features for your user base by simply toggling the feature flag On or Off. Simply toggle the feature flag Off once the feature is ready to be released to the customers.
A perfect solution to gate the features.
Let’s dive into the world of feature flags more deeply and try to understand some of their benefits.
Feature flags are not just meant for developers. They can be used by sales, customer support, marketing, and product management teams for multiple use cases. They can be used to manage beta programs, demos, limited availability of the features for targeted audiences, testing, etc.
Companies like Netflix, Google, Flickr, Facebook, and Reddit have been using feature flags to show and hide features, increase productivity, mitigate risk, target their audience, A/B test their traffic, and for various other use cases.
With the rise of Continuous Delivery/Continuous Deployment, development teams ship new code to production all the time.
Feature Flags provide the control to developers to ship the features only when they are ready. The teams can push new code directly to users in minutes using the feature flags.
In a percentage-based rollout, small numbers of users are selected to test the new feature. You can gradually increase or decrease that percentage over time. This method provides the opportunity to observe the behavior of the system under new changes. You can push the changes to your user base only when the changes are stable and user feedback is positive.
Having an opportunity to test with real, live users in the production environment can provide a much more accurate understanding of the system’s behavior. But the question is how to perform testing in the production environment without worrying about rolling back or redeploying in case of any roadblocks.
The feature flag platform comes with powerful targeting and custom rules to control access to new features. You can instantly turn off the access to any feature, bringing back the old behavior by simply toggling the feature flag.
Feature flags give engineering teams the ability to deliver more features with less risk. Development teams can wrap different versions of code in conditional statements that you can turn on and off at will. This provides flexibility to a developer to work more efficiently with less stress, especially before any deployment.
Feature flags have changed the world of building and releasing an application. Using feature flags, you can clearly define which features need controlled rollouts to different users, which needs to be managed by the PMs, sales, or support teams for a demo or beta program. You can simply turn on or off a flag for customers which provides better flexibility and control to both development and non-development (PMs, sales, marketing, customer support) organizations. Feature flags ensure that engineering is not a bottleneck for business teams to make changes for specific customers.
Decoupling the deployment from the release helps to plan the following strategies efficiently:
It would be perfectly alright to say that feature flags allow developers to create their own private swim lanes for their code. Using that, they can control how to ship a feature for individual customers, or for a group of users, etc. They have all the power to manage who sees what. Depending on the feedback, they can turn a feature on or off as needed.
This is not only a powerful tool for the development teams, but also equally powerful for the product managers. Feature flags can help development and DevOps teams lower their overhead and increase their velocity, and they can help product managers better control releases, coordinate launch timings, and create a feedback loop more effectively.
The ability to release changes to a limited set of users makes it much easier to gather feedback about the product. You can create a beta group of users and target feature flags specifically to that group. Testing new features with a subset of users allows developers to find and address bugs before the major release.
Without feature flags or in traditional development models, code deployment and feature rollouts happen simultaneously. Both functions cannot work independently.
Feature flags give you the ability to separate both functions. You can roll out a feature to a group of users without deploying your code, or vice-versa. This minimizes the risk of introducing any unwarranted risks in the production environment and avoids negative impacts to your customer or user base.
This also helps in testing your feature in production, continuous delivery of features with the controlled rollout.
Enabling or disabling a new feature can be as easy as turning a switch on or off. Just toggle the flag on or off without having to redeploy the entire source code.
Imagine you are a mobile app developer and a bug is reported in one of the new features that you just shipped. You can swiftly roll back the feature without touching your source code. You are saving the trouble of going through the lengthy app store review process. Isn't it a big enough reason to adopt feature flags?
If you are not yet convinced of the benefits that feature flags can offer, you should definitely read through this paragraph.
Feature flags provide the ability to act as a kill switch that allows anyone on your team to quickly and easily disable a feature if needed. If a critical bug is discovered in the production environment, you do not have to worry about rolling back the code from the complete user base. You can simply toggle the flag on or off depending on the situation. This also helps to avoid the complete code review process.
This also empowers the support teams to use a kill switch in the event of a failure, or if a bug is introduced because of a new feature. They can use the feature flagging framework and disable the feature without touching the code, allowing teams to fail safely.
The reason could be any or many, but it's the quickest and easiest way to disable the feature. In turn, it also allows your customers to have better trust in your company and products.
We discussed multiple benefits of feature flagging, however it is important to consider the following points before you implement feature flags:
I can’t emphasize enough the power and impact of dogfooding to move faster and build together more effectively.
Some of the unique features that Harness Feature Flags provide were compelling enough for the engineering teams and other departments (PMs, Ops, QA) in Harness to adopt Harness Feature Flags. Why not drink the wine from your own vineyard?!
At Harness, we have successfully migrated to Harness Feature Flags for all our products. We also continue to actively monitor the usage of Harness Feature Flags for all stakeholders (Ops, Product Managers, QA, and Developers) to improve the feature flag management experience for everyone.
Results are early because we just launched this ship, but definitely very promising. Today, Harness Feature Flags manages 250+ feature flags internally across 7 environments.
Feature flagging has made the life of different stakeholders easier and has also reduced a lot of interdependencies.
Thank you for taking the time to discover how you can benefit from using feature flags. Harness Feature Flags are equipped with all the power and capabilities that you are looking for:
Come and ship more features with less risk with Harness Feature Flags. If you want to understand more about Harness Feature Flag and its offering, check out the Feature Flags Documentation. We also have a great piece for you on 5 Feature Flag Use Cases You May Not Have Thought Of - just to keep you learning more about the awesome power of feature flags!
Happy Feature Flagging with Harness!