What is a Togle?

A toggle is a switch that has two positions, on and off. It is used to modify settings, preferences and other types of configuration. Toggles are often paired with other UI controls, such as sliders, to provide more granular control over settings. Unlike sliders which require an up/down action, toggles can be pressed and released quickly. It is important to use consistent terminology, especially when discussing features, so that users understand what each UI component does.

The word toggle can also refer to a pin passed through an eye or loop in a rope, so as to bind it temporarily to another such loop or eye. It can also be used figuratively, such as when a person toggles between two screens during a video chat with two different friends. The word is also used to describe an action in a game of basketball where a player moves between defensive and offensive roles.

Using static files to manage toggle configuration becomes cumbersome as your team scales. Modifying these configurations manually is fiddly and testing against them can be prone to errors. As a result many teams choose to move their toggle configuration into some type of centralized repository, often an existing application DB. This approach is often accompanied by the build out of a UI which system operators, testers and product managers can use to view and modify feature flags as well as their configuration.

Some teams prefer to keep their feature toggle configuration in source code, either as hardcoded comments or by using a preprocessor’s #ifdef feature where available. This approach can be more agile and streamlined than a full blown distributed configuration system but it still lacks the ability to dynamically re-configure individual flags at runtime. For this reason it is usually best used for ops toggles or more stable features which aren’t changing much over time.

Regardless of the method you choose to manage your feature toggles it’s always wise to test them against both their current and expected states. For example, many teams make a point of testing against an experiment toggle configuration which is flipped Off and one that is flipped On to see what effect it has on the system as a whole. This way any regressions which occur are easier to identify and correct.