Exhale! It's done.

That massive feature is finally deployed and in production.

You're feeling good, the stakeholders are happy to hear of the release, and surely the users are thrilled, too... right? Right?!

Not 5 minutes later, you get a Slack notification. It's from Carla, the sweetest customer support person ever.

Wait.

That was in #general?! Oh no.

You frantically pull `main` and test locally. Yep, it's busted.

Great. "Help."

You found the issue.

Hotfix branch. Commit. Push.

PR's up.

Right.

Tough pill to swallow, but it's possible that you're introducing other issues with frenetic fixes... and there's no guarantee that you're not resolving all issues.

Even though it stings, you revert.

Now we wait 20 minutes for things to build and deploy into production.


How many problems did YOU see?


What Are Feature Flags?

Feature flags, also known as feature toggles, are tools that enable development teams to separate feature delivery from feature release. Think of them as a magic switch. With a flick of this switch, you can turn a feature on or off without having to redeploy your code. Sounds fantastic, right?

But wait, there's more! Not only do feature flags allow you to control feature releases, but they also give your product team the power to make release decisions. This means, you, my dear developer friends, can focus on what you do best: creating and delivering awesome features, knowing that the when and who of the release is taken care of.

Benefits of Using Feature Flags

Feature flags are the safety nets that catch you when you fall. They're working behind the scenes to make your development process smoother, faster, and more efficient.

Now, let's look at these benefits side by side.

Benefit

Description

Gradual Rollout

Allows for incremental release of features, reducing the risk of full-scale rollout failures

A/B Testing

Enables real-time user feedback on different feature versions to aid in decision making

Canary Releases

Facilitates performance monitoring of new features in a controlled environment before full-scale deployment

Operational Rollback

Provides the ability to scale back or disable features that have unintended consequences.

Implementing Feature Flags

Implementing feature flags isn't like rocket science...or even building Ikea furniture. Essentially, it involves wrapping your features (or parts of features) in conditional statements that check the status of the flag. There are a ton of feature flag management packages in many languages and some built into popular frameworks. There are flag management SaaS orgs that handle this for you. But, really, implementing these from scratch isn't much of a reach if you're into it.

Best Practices for Feature Flags

As the saying goes, "There's no such thing as a free lunch." (By the way, when I was doing some background work for this post, this saying is referred to as TANSTAAFL -- I'm struggling to believe this is real. Is this an acronym? Does it rhyme with "waffle" or is it a mouthful of an initialism? Seems dubious to me. I can get behind yagni, but tanstafle is a bit much.) When feature flags are no longer needed, the associated code with the unused logic branch AND the flag itself must be cleaned up and removed. If the clean up step is skipped, this is a sure way to end up with a tower of tech debt. The goal is a sleek, well-tuned codebase protected and enhanced by flags, not a bloated ball of mud.


Back to our example from the beginning. The most egregious problem IMO is letting the user be the conduit for release feedback. We need operational visibility. What problems did you see?

Also published here.