Togle (pronounced toggl) is a word in Wiktionary which means “to switch.”
In computer language, toggle refers to a switch that has two outcomes, on and off. It is used extensively in software options menus, where users can mark certain items as On or Off.
Toggles can be a great way to display preferences, settings, and other information. However, they should be used in context and should not be overused.
Static Configuration versus Dynamic Re-Configuration
When feature toggle configuration is centralized, in most cases it makes more sense to maintain them as static files. This approach is more scalable and easier to manage across a large fleet of servers.
If toggles are to be managed in a dynamic fashion they can become quite fiddly. One option for managing toggle configuration is to hardcode them into a preprocessor’s #ifdef feature, where available. This is a more sophisticated approach but it is not suitable for all feature flags.
Overriding Toggle Configuration
If your feature flag system allows you to override toggle configuration from the runtime, this is an attractive approach for a number of reasons. First of all, it can make testing simpler.
It also helps to ensure that the toggle is always in the correct state, and avoids surprises when the release goes live. This is especially important when testing less dynamic flags, where the toggle may be configured to enable behavior which isn’t expected.
While this kind of overriding is often necessary for more advanced feature flags, it should be avoided by teams who prefer to use static configuration. It can be a major pain to change toggles during development or deployment, and can negatively impact the feedback loop that CI/CD provides.