What is featureflags?
Feature flags (also called feature toggles) are simple switches in your code that let you turn a specific feature on or off without changing the underlying software or redeploying it. Think of them like light switches: the code for the light is always there, but you decide when the light is on.
Let's break it down
- Code place: You add a small conditional check around a new piece of functionality.
- Flag storage: The flag’s value (true/false) is stored somewhere you can change it - a config file, a database, or a dedicated feature‑flag service.
- Evaluation: When the app runs, it reads the flag and decides whether to execute the new code or skip it.
- Control: You can change the flag at runtime, for a single user, a group of users, or everyone.
Why does it matter?
- Safer releases: Deploy new code but keep the feature hidden until you’re ready.
- Quick rollbacks: If something goes wrong, just flip the flag off instead of rolling back the whole deployment.
- A/B testing: Show the feature to a subset of users to gather feedback or compare performance.
- Gradual rollout: Enable the feature for a few users, monitor, then expand gradually.
Where is it used?
- Web and mobile apps - to launch new UI components or APIs.
- Microservices - to control behavior across many services without redeploying each one.
- Continuous delivery pipelines - as part of automated release processes.
- Enterprise software - to enable premium features for specific customers.
- Open‑source libraries - to keep experimental code behind a flag until it’s stable.
Good things about it
- Reduces risk of big releases.
- Allows fast, reversible changes.
- Supports experimentation and data‑driven decisions.
- Enables developers to merge incomplete work without exposing it.
- Improves collaboration between product, dev, and ops teams.
Not-so-good things
- Adds extra complexity to the codebase; too many flags can become hard to manage.
- Risk of “flag debt” if old flags are never removed.
- Can hide bugs that only appear when the flag is on.
- Requires reliable storage and monitoring of flag values.
- May lead to performance overhead if flag checks are not optimized.