2016-02-01 18:45:54 +00:00
|
|
|
---
|
|
|
|
layout: pattern
|
|
|
|
title: Feature Toggle
|
|
|
|
folder: feature-toggle
|
|
|
|
permalink: /patterns/feature-toggle/
|
|
|
|
categories: Behavioral
|
2021-05-19 10:49:05 -06:00
|
|
|
language: en
|
2016-02-01 18:45:54 +00:00
|
|
|
tags:
|
2019-12-13 21:09:28 +02:00
|
|
|
- Extensibility
|
2016-02-01 18:45:54 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
## Also known as
|
|
|
|
Feature Flag
|
|
|
|
|
|
|
|
## Intent
|
|
|
|
Used to switch code execution paths based on properties or groupings. Allowing new features to be released, tested
|
|
|
|
and rolled out. Allowing switching back to the older feature quickly if needed. It should be noted that this pattern,
|
|
|
|
can easily introduce code complexity. There is also cause for concern that the old feature that the toggle is eventually
|
|
|
|
going to phase out is never removed, causing redundant code smells and increased maintainability.
|
|
|
|
|
2019-12-07 20:01:13 +02:00
|
|
|
## Class diagram
|
2016-02-01 18:45:54 +00:00
|
|
|

|
|
|
|
|
|
|
|
## Applicability
|
2017-08-31 01:50:33 +05:30
|
|
|
Use the Feature Toggle pattern when
|
2016-02-01 18:45:54 +00:00
|
|
|
|
|
|
|
* Giving different features to different users.
|
|
|
|
* Rolling out a new feature incrementally.
|
|
|
|
* Switching between development and production environments.
|
|
|
|
|
|
|
|
## Credits
|
|
|
|
|
2019-12-07 20:01:13 +02:00
|
|
|
* [Martin Fowler 29 October 2010 (2010-10-29).](http://martinfowler.com/bliki/FeatureToggle.html)
|