A toggle is a feature that can be switched between two states: on and off. It’s a great tool for support teams to use when providing support on existing features and is also a powerful tool for product development teams to use to experiment with new functionality before its full rollout.
Feature toggles enable trunk-based development for teams practicing Continuous Delivery, by giving teams the ability to hide features in production while they’re still being developed and tested on a code branch. This process allows a team to get feedback from a large audience before they fully integrate the feature into their main codebase.
In addition to providing a testing environment, feature toggles can be used as circuit breakers in your application by turning off non-essential features during periods of high latency. This allows you to reduce downtime while maintaining stability for your users.
Toggle configurations can be set to live for a few days/weeks or semi-permanently. The longer the life of a toggle, the more important it is to make sure the toggle is designed well and the code for switching between states is readable, understandable, and can be changed easily.
Savvy teams often have rules for adding a toggle removal task to their backlogs for every new toggle that they create, so that they are proactive about removing feature toggles when they’re no longer needed. Some even put “expiration dates” on their toggles so that they automatically fail a test (or even refuse to start the application!) if the toggle has not been removed by the date.