A toggle is a switch that allows you to select between two different states or options. It’s a common tool used in technology, computing, programming, and communication devices to allow users to adjust settings or modes.
Toggles are a feature that lets your engineering team quickly roll out and back features in a live environment to test them out with real users. This helps you to reduce the amount of time you spend debugging and allows you to rapidly respond to any problems that occur during a high latency period.
When a feature toggle is ON, your users see the version of the product that has the new feature implemented. When the feature toggle is OFF, your users see the original version of the product without the new feature.
Release Toggles are typically short-lived, although some product-centric toggles can stay in place for longer. The toggling decision for a Release Toggle is very static – once it’s baked into the release, it’s difficult to change, although rolling out a new version with a toggle configuration change is perfectly acceptable.
Champagne Brunch Toggles are long-lived compared to other categories of Feature Toggles and often remain in place for multiple years or more. The toggling decision for a Champagne Brunch Toggle is generally per-user based and as such can be a more dynamic toggle than other categories.
Admin Toggles are long-lived if you use them to manage permissions, and may need to be changed at a large scale (for example, if your article has many subscribers who can access it). You should also avoid using admin toggles on pages that you want to keep private, as it will be possible for anyone with knowledge of the page’s source code to see hidden content.
Toggle Configuration is the set of flags that determines whether a particular toggle is ON or OFF. The configuration of a toggle can be managed with a number of techniques, from simple commenting through to advanced preprocessor-based solutions. However, you should always try to reduce the number of toggles that are idle in your code – the more idle toggles, the more overhead they add to your program. The best way to do this is by creating a process in your workflow that ensures that all toggles are pruned as soon as they’ve run their course. This prevents your team from becoming swamped with unnecessary management tasks. Alternatively, you can use a tool such as Toggle Manager to automate this task. It’s also important to have a clear process for reviewing the status of toggles and vetting that they are still the right solution. This includes establishing the criteria for when a toggle should be removed, such as an amount of time since it was last used. You can also use a Toggle Manager to create an automatic queue of idle toggles that will be automatically pruned at regular intervals. This can be done by adding a ‘Toggle Manager’ job to your continuous delivery pipeline.