What is FEATURE TOGGLE? What does FEATURE TOGGLE mean? FEATURE TOGGLE meaning & explanation

What is FEATURE TOGGLE? What does FEATURE TOGGLE mean? FEATURE TOGGLE meaning – FEATURE TOGGLE definition – FEATURE TOGGLE explanation.

Source: Wikipedia.org article, adapted under https://creativecommons.org/licenses/by-sa/3.0/ license.

SUBSCRIBE to our Google Earth flights channel – https://www.youtube.com/channel/UC6UuCPh7GrXznZi0Hz2YQnQ

A feature toggle (also feature switch, feature flag, feature flipper, conditional feature, etc.) is a technique in software development that attempts to provide an alternative to maintaining multiple source-code branches (known as feature branches), such that the feature can be tested, even before it is completed and ready for release. Feature toggle is used to hide, enable or disable the features, during run time. For example, during the development process, the developer can enable the feature for testing and disable it for remaining users.

Continuous release and continuous deployment provide developers with rapid feedback about their coding. This requires the integration of their code changes as early as possible. Feature branches introduce a bypass to this process. Feature toggles are an important technique used for the implementation of continuous delivery.

The technique allows developers to release a version of a product that has unfinished features. These unfinished features are hidden (toggled) so they do not appear in the user interface. This allows many small incremental versions of software to be delivered without the cost of constant branching and merging. Feature toggles may allow shorter software integration cycles. A team working on a project can use feature toggle to speed up the process of development, that can include the incomplete code as well.

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 toggles. A block of code which has been toggled ‘off’ is similar to it being commented out. This allows developers to control the flow of their software and bypass features that are not ready for deployment.

The main usage of feature toggles is to avoid conflict that arises due to 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 toggles. 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 toggle 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.
Property in a configuration file.

Another benefit of feature flags is canary launches. A canary release (or canary launch or canary deployment) allow developers to incrementally test features by a small set of users. If a feature’s performance is not satisfactory, then it can be rolled back, without any adverse effects.

While the pattern can be implemented very simply in most programming languages (e.g. Java, Angular JS, PHP, JavaScript, etc. ) there are libraries available to further simplify usage.

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.

There are many open source feature toggling and feature flagging solutions for different programming languages and platforms.

source