So, you shipped a new feature.
Congrats! 🎉
Now the app's acting weird.
Do you nuke the whole release?
Nah. Enter feature flags.
What Are Feature Flags?
Feature flags (aka feature toggles, aka "please don't break prod") let you flip features on or off without redeploying.
It's like hiding switches all over your codebase, so you can turn stuff on for your favorite users—or just yourself, let's be honest—and turn it off when things inevitably go sideways.
Martin Fowler calls feature flags:
"a powerful technique, allowing teams to modify system behavior without changing code."
Translation: you can break things more safely.
Why Use Feature Flags?
Let's say you want to test a new feature, but only on Dave's machine because he's the only one who reads the docs.
Or maybe you want to roll out a change slowly, just in case it's cursed.
Feature flags let you:
- Deploy Safely — Ship code to production while keeping the scary stuff hidden.
- A/B Test — Show different features to different users and pretend you're doing science.
- Instant Rollback — Flip a switch and pretend nothing ever happened.
- Continuous Delivery — Ship all the time and break things less. In theory.
As Scott Hanselman puts it, feature flags let you separate deployment from release, giving you the power to experiment and react quickly.
That's a pretty useful superpower.
How Do Feature Flags Work?
It's just a boolean, folks.
On or off.
Store the flag in your code, a database, or some SaaS. Your application checks the flag before running the relevant code.
You can make it as complicated as you want—user-specific, time-based, or tied to the phase of the moon.
Here's a basic example in C#:
public async Task<IActionResult> Index()
{
if (await _featureManager.IsEnabledAsync("NewDashboard"))
{
return View("NewDashboard");
}
return View("OldDashboard");
}
Simple enough.
But if editing appsettings.json every time you want to flip a flag sounds like a bad time, you're not wrong.
A central flag management server with a proper web UI is the better move:
- No config file edits
- No redeployments
- No waiting for CI/CD
- Just a switch you can flip from a browser
If you're impatient, FeatureFlags.app is free to try.
The Code Monkey's Caution
With great power comes great spaghetti.
Too many flags and your codebase becomes a haunted house.
Label your flags. Document them. Delete them when you're done.
You won't.
But you should.
Conclusion
Feature flags help you:
- Ship safely
- Experiment with new functionality
- Roll out changes gradually
- Turn off broken features without a redeploy
- Separate deployment from release
Use them wisely, and maybe you'll survive your next production release.
And if you want a simple way to manage your flags without wrestling with config files, give FeatureFlags.app a try.
Case closed. For now. Go get coffee.
Top comments (0)