Also known as a feature toggle, a feature flag is a way to turn a module or sub-section of a product on or off. This allows a development team to change the behavior of an application without necessarily having to redeploy or rewrite code.
Along with other concepts including automated testing and CI/CD (continuous integration/continuous delivery), feature flags are great for quick and efficient development during production cycles. They allow for the partial testing of a product in production mode while modifications are still taking place. Once ready, the feature is toggled for full availability. But what specifically can you use them for?
How do feature flags speed up development?
To answer this question, you need to understand some basics about how software is released. In the old days of deployment schedules for system updates, devs created new features and compiled them into the main code for an application. Think of the times that Microsoft released entire service packs to update their operating system.
When programmers finished developing the code and testing the update, it was released to the general public through a patch or an upgrade. In most cases, a company would make these releases available to a select group of end-users who could test the features in a production environment and provide feedback. Some risk-taking companies simply released the update and obtained customer feedback without a beta test.
This type of release had a few inherent problems. Since the updates took a while to develop and the deployment required more resources, developers grouped features and fixes into a single release. The idea was to pack as many fixes and updates in a single release to save valuable resources.
However, say that an end-user was waiting on a specific feature or fix — that customer would have to wait until the software company released the entire update, which was detrimental to the customer experience. Furthermore, it took time to receive feedback on any bugs or possible issues that arose out of the use of the update.
Today, releases are much more streamlined. Nevertheless, the use of feature flags can increase the speed and customer experience even more. Companies can produce continuous delivery for specific items that are ready to roll out without needing to wait for an entire compilation. This not only reduces the time to launch, but it also provides a way to receive production-time feedback that can be addressed immediately before a full-scale release.
The smaller increments of continuous integration produce safer code that increases user satisfaction. Additionally, engineers spend less time figuring out bugs and fixes and can focus their attention on additional features that generate revenue.
How else can feature flags be effective?
Decreasing deployment time and increasing efficiency is not the only use for feature flags. Using this methodology also allows programs to be scaled and features to be degraded easily. For example, sites that see an immediate spike in traffic can use the flags to remove the pressure without bringing the entire site down. This type of scaling is critical to maintaining service levels.
An additional way that companies can use feature flags is to obtain immediate feedback produced by an instant toggle. For example, organizations curious about how an end-user may view an idea for a feature can create a feature flag and measure interest. This is a creative way to develop market research without having to develop an idea completely. If the feature attracts enough attention, the organization can proceed to build the component. Otherwise, resources were not needlessly invested on a guess.