Implementation
Feature toggles are essentially variables that are used inside conditional statements. Therefore, the blocks inside these conditional statements can be toggled 'on or off' depending on the value of the feature toggle. This allows developers to control the flow of their software and bypass features that are not ready for deployment. A block of code behind a runtime variable is usually still present and can be conditionally executed, sometimes within the same application lifecycle; a block of code behind a preprocessor directive or commented out would not be executable. A feature flag approach could use any of these methods to separate code paths in different phases of development. The main usage of feature toggles is to avoid conflict that can arise when merging changes in software at the last moment before release, although this can lead to toggle debt. Toggle debt arises due to the dead code present in software after a feature has been toggled on permanently and produces overhead. This portion of the code has to be removed carefully as to not disturb other parts of the code. There are two main types of feature toggle. One is a release toggle, which the developer determines to either keep or remove before a product release depending on its working. The other is a business toggle, which is kept because it satisfies a different usage compared to that of the older code. Feature toggles can be used in the following scenarios: * Adding a new feature to an application. * Enhancing an existing feature in an application. * Hiding or disabling a feature. * Extending an interface. Feature toggles can be stored as: * Row entries in a database. * A property in a configuration file. * An entry in an external feature flag service.Feature groups
Feature groups consist of feature toggles that work together. This allows the developer to easily manage a set of related toggles.Canary release
A canary release (or canary launch or canary deployment) allows developers to have features incrementally tested by a small set of users. Feature flags provide an alternate way to do canary launches and allow targeting by geographic locations or even user attributes. If a feature's performance is not satisfactory, then it can be rolled back without any adverse effects. Martin Fowler states that a feature toggle "should be your last choice when you're dealing with putting features into production". Instead, it is best to break the feature into smaller parts that each can be implemented and safely introduced into the released product without causing other problems. Feature-toggling is used by many large websites including Flickr, Disqus, Etsy, Reddit, Gmail and Netflix, as well as software such as Google Chrome Canary.See also
* Software configuration management *References
{{Reflist Software development process Computer programming