A toggle is a hardware or software switch that lets you enable or disable functionality. Toggles are widely used in everyday technology devices and software applications like the Caps Lock and Num Lock keys on a keyboard or the options menu in most programs. Feature toggles are also used in software development to help teams experiment with and test new features before they rollout them to all users.
There are several ways to implement feature toggles in an application, ranging from a simple commenting approach through to more sophisticated approaches using preprocessor flags and code conditionals. Whichever you choose, the best practice is to always have a way for the team to easily modify and re-configure the toggle configuration. This is particularly important when a toggle is a part of a Canary Release or Champagne Brunch where you are testing a feature with a small subset of your user base.
Having the ability to change the toggle state on demand gives the team flexibility and reduces the risk of releasing a feature that has unexpected impact on an entire audience. For example, you may wish to delay the rollout of a particular change for a few weeks and then bring it back in line with your production release schedule. Alternatively, you may need to temporarily disable an existing feature for a period of time to ensure your frontend servers can cope with the load.
For these cases, the best way to manage your feature toggles is through a centralized repository such as Kameleoon that can automatically create and remove Feature Toggles when they are no longer needed. This avoids the need for a team to manually add and remove code in a complex application codebase and helps to minimize technical debt.
It is also wise to be proactive in removing old toggles when they are no longer needed as part of a continuous integration and delivery process. Savvy teams will often make it a rule to add a task to the team’s backlog to remove any toggle that they expect to be removed from production, so they can keep their inventory of active toggles as low as possible.
Finally, it is also a good idea to create an automated test to check that all toggles are currently flipped off and are not in any way enabled or hidden by other features. This is a useful step to take before you deploy a new version of your app, and it helps to prevent any accidental regressions from being introduced by other changes or bugs that have been fixed.
If you’re interested in using feature toggles in your application, the Kameleoon platform is free to try and comes with a number of templates for use on your website. It is easy to configure and use and can be installed from a one-click install. To get started simply login to your Kameleoon account and select a template from the list of available toggles.