A toggle is a switch that can be set to one of two positions, on or off. It is a common concept in both hardware and software and is clearly visible in the options menus found in many programs. A toggle is used to enable users to update their preferences and settings quickly and easily. It’s important to avoid using toggles unless they are necessary because when done poorly it can have a negative impact on user experience.
Managing toggle configuration through static files becomes cumbersome at scale. It is difficult to ensure that a feature flag will be flipped when a code path is executed, and it’s also difficult to reliably test if the override has been correctly implemented. To address this problem many teams move their toggle configuration into some type of centralized store, usually an existing application DB. They also build-out some form of admin UI which allows system operators, testers and product managers to view and modify toggle configuration.
It is wise for a team to test the toggle configuration that they expect to go live in production, as well as the fallback toggle configuration which is all toggles flipped Off. However, it’s not a good idea to test every possible combination of toggle configurations because testing for everything that could be flipped is impractical and can create false positives in your regression tests. A toggle should only be flipped on by a person who understands how it will affect the user’s experience, and who is prepared to commit to testing it fully in the event that it causes a bug or regression.