Managing Feature Toggles
A toggle is a switch that has two positions: ON and OFF. It’s used in software to control features that are initially off so that when the switch is flipped on the feature becomes active. For example, the Caps Lock and Num Lock keys on a keyboard are toggles that allow you to switch functions on and off. In software, toggles are commonly found in options menus where users can choose from a list of settings and preferences.
Toggles are preferred over radio buttons when changing settings for a user because they take up less screen real estate and require fewer clicks. Toggles are also ideal when changing the state of a system function (i.e. Airplane Mode). The only downside to toggles is that they can’t be set to a middle ground like OFF or NO, so if you want users to select either ON or OFF it’s best to use a radio button instead.
When managing Feature Toggles it’s important to think about how dynamically re-configuring them is going to play out in the production environment. There are a number of different ways to do this, from the very simple (commenting) all the way up to more complex approaches which involve rewriting code to handle the re-configuration.
The simplest approach is to hardcode the toggle configuration into source code using an #ifdef or preprocessor feature, where available. This is a good solution for relatively short-lived toggles, such as those in the scope of a Canary Release. When this approach is deployed it’s imperative to test both the live toggle configuration and the toggle configuration as it will be rolled out into production, including any toggles which are flipped ON that may have been accidentally flipped in the process of testing.
Another more sophisticated option is to move toggle configuration into some type of centralized store, often an existing application DB. When done this is usually accompanied by some form of admin UI that allows for system operators, testers and product managers to view and modify Toggle Configuration and Feature Flags.
The name Toggle is meant to reflect the importance of the role technology plays in all organizations, and the men and women who are responsible for making it all work. We’re committed to shedding light on the unique challenges they face, and sharing the innovative solutions they’ve developed to meet them. From data privacy and cybersecurity to artificial intelligence and machine learning, we’re here to help you navigate the ever-changing IT landscape with confidence.