In trunk-based development, changes to the code base are consistently merged into the main trunk and pushed through to testing and production in a systematic way. Feature flag best practices are essential to maintaining the integrity and stability of code deployment, as many different features and even multiple feature branches can be included under unique feature toggles to be turned on and off when necessary.
Definition of Feature Flags
In its most basic sense, a feature flag is a section of code governing the execution of a specific software feature, allowing that feature to be “toggled” on and off without a new deployment. When a developer wishes to add new functionality, the feature can be implemented under a feature toggle in order to avoid impacting the user experience until the functionality is complete and verified in production.
How Feature Flags Work
By wrapping new feature code blocks with feature flags, developers can merge new code into the main trunk without affecting the release as a whole. New features can be activated selectively and their effect on the overall platform is monitored.
Features can be selectively enabled or disabled for specific groups of users, allowing for individual features to undergo a phased rollout that occurs in stages. Feature flags can also be used as A/B testing tools by deploying two different versions of a given feature at once, restricting each to a certain environment, and enabling them for different groups of beta users to see which performs better.
Importance of Feature Flags
With feature flags, it’s no longer necessary to bundle multiple new features together for testing and release in a single, large periodic software update. Instead, it’s possible to perform continuous delivery, an iterative development approach where features are deployed, rolled out, and tested in a larger number of smaller payloads. It’s not uncommon for release cadence to increase by 10x or 100x as teams go from quarterly or monthly “big bang” releases to daily, weekly, or even hourly continuous delivery of smaller, more easily observed rollouts.
Feature flags are an essential tool in modern software development. They enable organizations to move faster while safely and securely implementing, testing, and delivering new features. You can try feature flags for free on Split’s Feature Delivery Platform.