What is a Toggle?

Togle

A toggle is a switch, lever or other mechanism that can move between two different states or options. It’s commonly used in electronic devices, systems and computer programming to provide a form of binary control. You can toggle something by turning it on and off or switching it between different modes — for example, you might toggle between streaming and map views when you’re video chatting with two friends at the same time.

The word toggle is also a verb meaning “switch or alternate” as in “I’m toggling back and forth between my work and watching TV.” You might also use it to describe the rapid switching of screens when navigating through an exhibit. For instance, you might want to toggle between the exhibit’s stream and its map view to get a better sense of the layout before you decide where to go next.

There are a number of ways to manage the configuration for toggles, ranging from relatively simple but less dynamic approaches through to some very sophisticated and complex implementations. In many cases the more dynamic approaches are favored for Ops Toggles where it’s important to be able to re-configure specific service instances (e.g. the ones which handle a specific customer’s requests) on a regular basis.

Savvy teams view the feature flags in their codebase as inventory which comes with a carrying cost and seek to keep that overhead low by being proactive about removing old toggles once they’re no longer needed. Some teams have a rule of adding a task to their backlog to remove a Release Toggle at the same time as the feature is introduced and others put “expiration dates” on their feature flags with a set of rules in place which will fail tests or even refuse to start services if the feature flag has expired.