What does a feature flag do?
A feature flag is a mechanism that lets you turn a specific piece of functionality on or off in an application without changing code or restarting it.
Why it's needed:
- A gradual feature rollout You can roll out new functionality to 1% of users first, then 10%, then everyone.
- A/B tests It's easy to split users into groups and show each one its own version of the feature.
- A fast switch-off when something breaks Something broke, the flag gets turned off, the feature disappears. No need to rush a fix out.
- Flexible configuration Features can be enabled by role, geography, time, browser, ID, and so on.
- Working in production without a rollout The code is already deployed to production, but the flag is off. Users don't see it. You change the value, the feature activates.
Summary: a feature flag is like a switch above every feature. Turn it on, it works. Turn it off, it's gone. You control the product in real time.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.