What Is a Toggle?
A toggle is a switch with two positions, either on or off. It can be a hardware or software element and is used in software to allow a user to change the behavior of an application. Toggle switches are commonly found in options or preferences menus but can be used anywhere in an application where there is a choice of two outcomes.
Using toggles in applications requires that the user understand that there will be some system delay before the new state takes effect. This is why it’s important to use clear labels and visual cues for the switch position. It also is best to avoid using toggles in situations where other types of form fields are present and users have to click or confirm the change. Instead, it is recommended to use a checkbox where immediate results can be achieved.
Savvy teams consider their codebase inventory of Feature Toggles to have a carrying cost and are proactive in removing toggles that are no longer needed. This can be as simple as adding a toggle removal task to the team’s backlog after a Canary Release or as complex as creating “expiration dates” on a toggle that will fail a test (and possibly even refuse to start an application!) if it’s not removed before its time has passed.
Another option is to use a type of runtime configuration to manage feature flags but this can be cumbersome for large deployments and can require that the underlying process be restarted in order to change its state, or worse, that the codebase be re-deployed. For this reason many teams opt to move Toggle Configuration out of static files and into some type of centralized repository such as an existing application DB where changes can be made more easily and consistently.