Everything You Need to Know About Feature Flags

Use this tool the right way and you'll level up.

Everything You Need to Know About Feature Flags

Feature flags can seem both easy to use and very complex. Their basic concept is pretty straightforward, but feature flags can be very powerful tools and using them correctly takes skill. Here’s everything you need to know about feature flags.

What are feature flags?

At their most basic, feature flags are a tool, that lets a coding team change the way a system behaves, without having to change the code. They allow you to get a function out there quickly, but control the chaos later on.

You might see feature flags referred to as feature toggles, feature bits, or even feature flippers. Don’t let this throw you, because they all refer to the same thing. You use your feature flags to turn a feature on or off in your coded offering. You can do so even after the code has been deployed.

Why would you want to use them?

Traditionally, software development required you to deploy your code, and roll out features at the same time. This was risky—deployed code simply never works the way you expect it to. The code production environment isn’t the same as the final user environment.

The only way to avoid serious problems at rollout used to be relying on testers to alert you to unexpected bugs and errors. This worked (mostly), but it was time consuming and an all or nothing situation. The other option was to just release quickly and wait for the fallout of user complaints.

With the power of feature flags, you can deploy your code and turn a feature on only for certain users. Once you’re sure it works, you can roll out the feature to all users.

Some Practical Examples

Let’s say you’re working on a game. Your team is tasked with updating a primary game function. Another team has been tasked to work on a side feature. Both of these codes will be long branched, and you know just what kind of chaos can happen when you merge long branches of code by different teams.

The team working on the side feature can put in a feature flag. That way, they can keep working without destabilizing the base or anyone else’s work. They can toggle the feature on and check that it’s not interfering, but the features they are working on won’t otherwise interact until you give the final green light.

Here’s another example: you can’t decide whether you want to use feature A or feature B. Simply, put them both into the code, and use feature flags to turn on A for some users and B for others. Monitor the reactions, and in a short time you’ll know which feature to erase, and which to turn on permanently.

Some Warnings

There are some best practices for using feature flags that will help you get the most out of them. First, be sure to give a clear name to your flag, so everyone working on the code recognizes it immediately.

Coordinate the release of your features, and make sure you test them together. If you have more than one feature flag, it is crucial that you not only remember to test each individually, but all of them in individual combinations and together.

Finally, don’t forget to erase your feature flag once you’ve made a decision about that bit of code. Of course, there may be a few feature flags you want to keep in place permanently, but for the most part, you’ll only be using them temporarily.

To get more details, consider what the experts have to say. Feature flags are powerful tools that will help you step up your coding game, but only if you use them right.

fact or fiction
Read next: Wearables vs The Virus | João Bocas | Engati Engage
Tobias Gillot
See all posts by Tobias Gillot