2016-02-16 15:27:07 +01:00
|
|
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
|
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
2020-07-21 09:37:15 +02:00
|
|
|
## Table of Contents
|
2016-02-16 15:27:07 +01:00
|
|
|
|
|
|
|
- [Why use feature flags?](#why-use-feature-flags)
|
|
|
|
- [Should feature flags be used for everything?](#should-feature-flags-be-used-for-everything)
|
|
|
|
- [References](#references)
|
|
|
|
|
|
|
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
|
|
|
2020-07-21 09:14:24 +02:00
|
|
|
# Why use feature flags?
|
2015-11-20 20:54:20 +01:00
|
|
|
|
2020-07-21 09:14:24 +02:00
|
|
|
- **Velocity**: coupled with a system to rapidly deploy configuration change,
|
2015-11-20 20:54:20 +01:00
|
|
|
it is usually much faster to disable new code by turning off a feature than
|
|
|
|
re-deploying all the code. This extra safety net helps developers be more
|
|
|
|
confident in their release, because they know they can roll back a change
|
|
|
|
very rapidly in case of error.
|
2020-07-21 09:14:24 +02:00
|
|
|
- **Testing**: the presence of a feature flag forces the feature owner to test
|
2015-11-20 20:54:20 +01:00
|
|
|
the flow. Without feature flags, the developer might deploy the change and
|
|
|
|
assume the absence of errors means the release was successful. Yet there's
|
|
|
|
numerous failure mode that don't raise explicit errors.
|
2020-07-21 09:14:24 +02:00
|
|
|
- **Code iterations**: because code can be kept hidden behind a feature flag
|
2015-11-20 20:54:20 +01:00
|
|
|
until it's ready to go live, developers can push smaller code changes that
|
|
|
|
are not fully integrated yet. Smaller pull requests ease the job of code
|
|
|
|
reviewers, make testing easier, and reduce the probability of a catastrophic
|
|
|
|
failure.
|
2020-07-21 09:14:24 +02:00
|
|
|
- **Gradual rollout**: feature flags enable gradual rollout, where a piece of
|
2015-11-20 20:54:20 +01:00
|
|
|
code is gradually activated, for instance on a per city basis, or on a per
|
2015-11-20 21:00:59 +01:00
|
|
|
user group basis. This builds confidence in the feature release process, and
|
|
|
|
allows the engineer to verify that the new implementation is actually better
|
|
|
|
(for instance, when coupled with A/B testing frameworks).
|
|
|
|
|
2020-07-21 09:14:24 +02:00
|
|
|
## Should feature flags be used for everything?
|
2015-11-20 21:00:59 +01:00
|
|
|
|
|
|
|
I don't think so. I think it's a matter of good judgment. Just like 100% test
|
|
|
|
coverage does not always make sense (provided lines that are not tested are
|
|
|
|
explicitly ignored), adding or not adding a feature flag is an engineering
|
|
|
|
decision.
|
|
|
|
|
|
|
|
When would I not use a feature flag?
|
|
|
|
|
2020-07-21 09:14:24 +02:00
|
|
|
- Simple changes: copy, logging, etc.
|
|
|
|
- When rolling back takes a few seconds
|
|
|
|
- Feature that is used only in asynchronous jobs that are safe to retry and
|
2015-11-20 21:00:59 +01:00
|
|
|
don't impact the user experience.
|
|
|
|
|
|
|
|
When should a feature flag be used?
|
|
|
|
|
2020-07-21 09:14:24 +02:00
|
|
|
- Large refactors
|
|
|
|
- Changing integration points
|
|
|
|
- Performance optimization
|
|
|
|
- New flows
|
2015-11-20 20:54:20 +01:00
|
|
|
|
2020-07-21 09:14:24 +02:00
|
|
|
## References
|
2015-11-20 20:54:20 +01:00
|
|
|
|
2020-07-21 09:14:24 +02:00
|
|
|
- Martin Fowler,
|
2015-11-20 20:54:20 +01:00
|
|
|
[FeatureToggle](http://martinfowler.com/bliki/FeatureToggle.html)
|
2020-07-21 09:14:24 +02:00
|
|
|
- Flickr, [Flipping Out](http://code.flickr.net/2009/12/02/flipping-out/): one
|
2015-11-20 20:54:20 +01:00
|
|
|
of the first articles on the topic.
|
2020-07-21 09:14:24 +02:00
|
|
|
- [Using Feature Flags to Ship Changes with
|
2015-11-20 20:54:20 +01:00
|
|
|
Confidence](http://blog.travis-ci.com/2014-03-04-use-feature-flags-to-ship-changes-with-confidence/)
|