Managing Feature Toggles

The word toggle is used in everyday technology to describe a switch that can be turned on and off. We find this kind of toggling in things like the caps lock and num lock keys on your keyboard or in software settings menus. Feature Toggles are the digital equivalent of these kinds of switches, allowing us to control the behavior of our systems by switching on and off certain features or modes.

The Feature Toggle mechanism is a powerful tool for delivering scalable user experiences and enabling data-driven optimizations of complex systems. However, it can be easy to get carried away with this power, and if not properly managed can lead to an overly complicated set of if-else statements in your codebase which can make testing and debugging the system more difficult.

A good practice for teams using Feature Toggles is to keep the number of toggles in your codebase as low as possible, especially if you are using them to support production releases. Savvy teams view their toggle inventory as a type of inventory that comes with a carrying cost, and seek to manage this cost by removing old toggles from the codebase when they are no longer needed.

Toggles are very often used to perform multivariate or A/B testing of various aspects of a system, such as a purchase flow in an ecommerce site or the Call To Action wording on a button. To implement this kind of testing, each user of the system is placed into a cohort and at runtime the Toggle Router will consistently send them down one path or another based on which cohort they are in. This allows the team to compare the performance of different code paths and eventually settle on which one provides the best overall experience for their users.

Using Toggles to test new features in production is a great way to ensure that the feature has been fully tested and will work as intended. However, it is important to remember that you should never use toggles in a way that will impact the experience of other visitors. For example, if you are testing the visibility of article sections it would be counterproductive to hide the article title, credits and vignette, as these are important parts of the user journey for most visitors.

It is also a good practice to name toggles clearly, so that everyone on the team understands what it does and why it exists. This helps with bug tracking, and makes it easier to identify and resolve issues if the toggle is not functioning correctly.