Feature flagging done right

Sujil Maharjan
4 min readDec 31, 2019

--

If you are a developer, at some point, you have faced situations where the development of new features is not ready for production, but the QA and internal business folks already need to see it. That’s when you flag your features in code so that it can be easily turned on/off as you go. To handle these we are tempted to create our own feature flagging tool in our code. That is what I would try to do too. However, choosing a well-built framework over re-inventing the wheel can help not only flag the features but also provide more insight into your feature performance in real-time, perform tasks like A/B testing and get a real User Experience.

I came across a feature management system Launch Darkly which helped accelerate the feature flagging and app deployment process. Launch Darkly is a tool that helps you organize multiple feature flags specific to application environments (dev/QA/prod/etc). The best part that I liked about this tool is that the change is instant. For example, you decide to add a new page in your app which shows the user’s health performance. It passed all the tests. However, once deployed in production, you get complaints from the users that the data they are seeing is wrong and you want to shut off the access to that page for the users, Launch Darkly allows you to immediately do that with just ONE click! Yes! Literally one click.

Feature flagging is more than just flags.

Previously, feature flagging used to be a switch to show/hide new features to help the software development process. However, today it can do much more if used effectively.

A/B testing

It is a way to compare two versions of the same feature/variable that tests people’s responses to each version giving more insight into the effective choice to make.

In the image, you can see that Start the Launch Darkly Journey button has different colors. These are two different versions created by Launch Darkly. The button class has been feature flagged. You can test the performance of each version and see which one does better in production. This helps provide the User Experience insight into your application and your feature choices. For example, in the image, people are more likely to click on the button if it is pink because it stands out rather than the brown button (left image) which is a bit dull. This can help get real responses from real users and make design decisions for your application.

Using Launch Darkly, I did it as simple as this:

<div className="button-bar">
<a href="#"
className={ isButtonFlashy ? "button hvr-back-pulse bg-flashy" : "button hvr-buzz bg-dull" }>
Start the Launch Darkly Journey
</a>
</div>

Targeted Audience

The flagging concept can be used to also target a specific group of audience. You can target certain features to be available to certain users or groups of users. For example, let’s say you have an app that has a crucial experimental update. You only want to release the feature to a group of beta users your team carefully selected. You can easily use feature management tools to only turn on the feature to your selective group so that you can gather an appropriate insight into the use of the feature.

The example shown above is a feature created in Launch Darkly which only displays the Pricing feature if the user belongs to the Beta Users group. You can go crazy and choose to enable the feature to people with a particular last name, geographic region and many more.

Gradual Rollout

Not only can you roll out the feature to a certain group of people, but you can also randomize the data by unevenly distributing the feature. You can roll out your feature to 25% of the users and gather the insights rather than deploying the feature to your production environment and hoping that the feature doesn’t crash your application. Percentage based rollout helps you control the application in the production layer. It gives you a lot of flexibility on how to manage your features.

You must be thinking…

This all sounds good but how do I actually do it? I currently have a if condition in my code that does basic feature flag my app needs.

Yes. A most generic form of “feature flagging” can be just done by using an if condition in the code. However, that means you will have to re-deploy your application every time you want to turn your feature on/off. In addition to maintaining your current application workflow. Moreover, getting real-world interaction data is the best app feedback that you can get. Using a proper feature management tool can help you achieve that adding value to your application and helping you make important business/design decisions.

How to get started with external tools?

If you haven’t felt it already, I used Launch Darkly for my application and fell in love with it. However, these are the list of tools in the market:

  1. Launch Darkly
  2. split.io
  3. AB Tasty
  4. Rollout by CloudBees

I hope this helps you accelerate your software development and think of feature flagging as more than just a tool to show/hide features. It improves development time. Especially, if you have a small startup and do not have infinite resources to analyze the User Experience, this small change can make a big improvement.

Next Up: If you have a React application, tutorial coming soon!

--

--

Sujil Maharjan

I am a full stack developer at Knowledgent, Part of Accenture, based out of Greater New York City Area, who loves rapid prototyping ideas into real-life.