What are Feature Flags and why use them?
Aakash | June 8, 2022
Introduction
What if there was a way to control the features without changing the initial code? How about an effective and swift CI/CD pipeline? Is there any way to reduce the stress around feature releases? Well, yes.
Introducing feature flags, a staple in the SaaS industry for feature control. Feature flags (in simpler words) are a software development technique that allows you to hide, enable, or disable features without deploying any new code. They act as a control switch wrapped around a feature code to manage their appearance.
Here’s an example of a feature flag;
if feature_flag is ‘on’ -> do_something() else: do_something_else()
Feature flags also go by other names, such as:
- Feature toggle
- Feature switch
- Feature flipper
- Conditional feature
- Feature control
Types of Feature Flags
Different types of feature flags are available to cater to different operational needs. However, this section will discuss four types of feature flags.
- Boolean: If you use a homegrown feature management system, you already know about Booleans. Boolean feature flags are simple and are mainly used to turn on or off any feature in the backend. However, they can also target features to specific users, groups, or a progressive rollout of a feature.
- String: A significant use for string flags is saving configuration values or text content for A/B testing. A string flag can have multiple variables, unlike the binary of Boolean flags.
- Numeric: A numeric flag is quite identical to the string flag, with the only difference being the values are numeric. A numeric flag can use the flag to set a “magic number,” which is a constant integer value used to create warnings and limits. For example, the system will show a maximum limit sign when sending a message to 10,000 individual customers if you’ve set the magic number for ‘sending a message” at 10,000. These numbers are set after thorough analysis and can be changed later on
- JSON: JSON flags are commonly used when you want to store a group of configurational values. The JSON flag can be more expressive of the specific behavior controlled by that flag.
Who Uses Feature Flags And For What?
The use of a feature flag swings between the product managers and engineers. However, both utilize the true benefit of the feature flags.
Product managers can use feature flags to validate, test, and get feedback on new features in production. We have covered how feature flags are a must-have for product managers in one of our previous blogs.
And here’s how it benefits the engineering team or DevOps.
The DevOps team uses feature flags to deploy any new feature safely and swiftly. In addition, the DevOps teams can quickly fix any technical issues that may arise without changing the rest of the system.
Even the sales team can use feature flags to get essential data such as the usage, need, or demand of any feature in the market space. Then, they can use this information to approach prospective customers with data-backed pitches. That means the sales team can set up a personalized demo account for their prospect by selecting a set of features suitable for the company’s use, increasing the chances of onboarding a new client.
Beyond safe and quick feature deployment, feature flags also help coordinate teams across the organization. For example, since anyone with access can control the feature’s functionality, the DevOps team can focus on a new project – maintaining the CI/CD pipeline. And if any glitches, bugs, or integration issues are found, feature flags can be used to switch off the feature and send it back to the DevOps team for a quick fix.
The Benefits of Feature Flags And Why Use Them?
Feature flags are pretty popular in the SaaS world. And did you know platforms like Facebook and Netflix use feature flags? Well, now you know.
There are many reasons why we use feature flags. We will list a few of them here:
- Complete Control: With feature flags, you can have full control over the functionality of a feature. You can choose to turn it on or off. This comes in handy when unexpected issues arise with the new feature. These can be an unknown bug, incompatible integration, or a glitch.
- Segment Users: There are high chances of different feature requirements with a broad user base. The best way to cater to these demands is by segmenting the user base; you can segment your users based on features with a feature flag.
- Test In Production: You can use feature flags to test any feature’s validity, effectiveness, and traffic response by turning it on for your beta users or a specific group of customers. Testing in production is a powerful approach used mainly by product managers.
- Quick Action: With feature flags, you can take action as soon as you know of a problem with any feature. If the feature increases the load time or alters your software’s UI, you can quickly roll back the feature using the feature flag. Having swift feature management reduces the negative experiences of your customers.
- Low-Risk Releases: With complete control and quick action possibilities over features, you can roll out any new feature without worrying about functional compatibility. A phased rollout is also possible, using feature flags to test the traffic response of the feature. You can release new features with a very low-risk rate with feature flags.
With all these benefits and the positive side of feature flags, it only makes sense to use it if you wish to follow CI/CD goals and provide your users with world-class features and a seamless experience.
Wait, you do not have to rush to ask your engineering team to build homegrown feature flags; we can help you out. Try our feature flag service, and give your engineering team the task they do the best: make new features.