Uncategorised

What Is a Feature Toggle?

A toggle is a simple user-interface component that allows users to choose between two opposing states. It is often used to control settings and preferences. It is also often employed in modal dialogs and forms to show or hide information. Toggles are the preferred user-interface control for changing settings on mobile devices, as they allow more flexibility than a checkbox or radio button. Toggle switches should be clearly labeled and offer immediate results when interacting with them.

A Feature Toggle can be anything from a simple “if” statement to complex decision trees that act upon a wide variety of conditions. Many teams use fitness test results from other features in their codebase, a setting from their feature management software or a variable provided by a config file as factors that determine which way a toggle flips.

Savvy teams view their inventory of Feature Toggles as a form of inventory that comes with a carrying cost and they seek to keep this quantity as low as possible. To this end they may add a task to their backlog for each new toggle that they create and some even build in the process into their management platform. Many teams also implement “expiration dates” on their toggles, ensuring that they are removed as soon as their lifecycle runs out.

While some teams will deploy a toggle for the entire duration of a Canary Release or Champagne Brunch it is more common to see a feature toggle as a transitional tool that supports dev teams as they write and test their new code. Depending on the product a team can even use a release toggles to support feature releases without the need for a code freeze.

For example an e-commerce company might use a feature toggle to split their production configurator into two groups of users who will experience different suggestion algorithms. The team can then analyze the data to learn which algorithm is performing best and eventually roll that algorithm out for all users.

When using feature toggles it’s important to remember that they can be confusing for users if they are positioned on the same page as other types of form fields. To avoid this it’s a good practice to place them on their own distinct screen or element and to use clear color and visual signifiers for each state (e.g. On and Off). When choosing colors to represent toggle states it is important to consider societal and cultural implications and the relative visibility of each state.

Finally, when testing a feature toggle it’s wise to test both the configuration which is expected to go live in production (with all of the toggles flipped On) as well as a fallback configuration with all of the toggles flipped Off. This can help avoid unexpected regressions when a toggle is later reverted to its default state.