Product
|
Cloud costs
|
released
October 25, 2021
|
3
min read
|

The Benefits of Feature Flags in Software Delivery

Updated
10/6/2023

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):

  • Feature Toggles (feature flags and feature toggles are almost used interchangeably)
  • Feature Switch
  • Release Toggle
  • Feature Controls 

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.

Defining Variation, Targets, Target Groups, and Targeting Rules

Boolean Flag Type


A Boolean flag typically has two variations: true or false. 

Boolean Flag Variations with Different Targeting Rules Which Display Different Results

Multivariate Flag Type

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.

Multivariate Flag Variations with Different Targeting Rules Which Display Different Results

Why Feature Flags?

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:

Example 1: Control the Visibility of a Feature

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 xyz@harness.io and abc@harness.io 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.

Example 2: Gate a Feature

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.

The Many Benefits of Using Feature Flags

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.

Benefit #1: Ship Only When You're Ready

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.

Benefit #2: Percentage Deployments

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.

Benefit #3: Test in Production

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.

Benefit #4: Ship More With Less Risk

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. 

Benefit #5: Decouple Marketing and Development

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:

  • How does a new change roll out to the customers?
  • How to release a feature?
  • Who will get this feature first?
  • Who will beta test the changes?
  • Will there be a progressive rollout of the feature?
  • How to manage a feature release for an external event?

Benefit #6: Control Who Sees What

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.

Benefit #7: User Feedback

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.

Benefit #8: Separate Code Deploy From Feature Rollouts

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.

Benefit #9: Rollback/Kill Switch

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?

Benefit #10: Flexible Code Management

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. 

Mindful Adoption

We discussed multiple benefits of feature flagging, however it is important to consider the following points before you implement feature flags:

  • Carefully choose which functionality or feature should be behind a feature flag. If the feature doesn’t affect an end-user interaction with an app, maybe that is not the best candidate to be behind the feature flag.
  • It is important that you perform regular housekeeping of your flags. If you create too many flags, then it might get difficult to keep tabs on all of them. If you toggle a 6-month old feature flag, it could be a recipe for disaster. It is recommended to keep feature flags short-lived.
  • Put lots of thought into which platform to go with. There are a few feature flag tools out there (Harness Feature Flags, Optimizely, LaunchDarkly, Split, and more). Carefully research them all to ensure long-term growth and scalability.
  • You also need to be mindful of the following factors:
  • What is the size of your engineering team?
  • How often do you release code to production?
  • How many features are going to be released?
  • How many flags do you want to deploy?

How Harness Benefits From Using 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?! 

  • Integration Into CI/CD Pipeline: Harness Feature Flags is integrated into CI/CD (Continuous Integration and Continuous Delivery) as a unified pipeline. By representing feature flags as a pipeline, feature flag management becomes a natural step in the everyday workflow of development teams.
  • Multiple Platform Language Support: Harness Feature Flags provides several SDKs in different languages to help you access feature flags from your applications, such as, Java, JavaScript, Node.js, Python, Flutter, etc. 
  • Manageability: Easy to manage and access flags across environments.
  • Better Performance: Supports streaming and polling mode and sends updates in milliseconds in real-time.
  • Flag Type: Boolean to Multivariate flags for simple to complex scenarios.
  • RBAC: Access control for different projects, environments, and users. Harness provides Role-Based Access Control (RBAC) that enables you to control user and group access to Harness Resources according to their Role assignment.
  • Targeting Users With Flags: You can target rules to control variations that you want to serve to your users. You can target users of your application, email addresses, systems, services, machines, resources, or anything else that can be uniquely identified.

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.

Learn More About Feature Flags

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:

  • Support For Every Major Language
  • Native CI/CD Integration
  • Scalable, Secure, Performant
  • Governance, Administration, & Auditing Across CI/CD & Feature Flags
  • Progressive Delivery

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!

Sign up now

Sign up for our free plan, start building and deploying with Harness, take your software delivery to the next level.

Get a demo

Sign up for a free 14 day trial and take your software development to the next level

Documentation

Learn intelligent software delivery at your own pace. Step-by-step tutorials, videos, and reference docs to help you deliver customer happiness.

Case studies

Learn intelligent software delivery at your own pace. Step-by-step tutorials, videos, and reference docs to help you deliver customer happiness.

We want to hear from you

Enjoyed reading this blog post or have questions or feedback?
Share your thoughts by creating a new topic in the Harness community forum.

Sign up for our monthly newsletter

Subscribe to our newsletter to receive the latest Harness content in your inbox every month.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Feature Flags