Feature Flags

Feature flags to enable and disable features for a specific group of users
💡
Key objective: release code to a specific set of users.

As described CI/CD using a trunk-based version control strategy will allow developers to get code into production faster.  However, there are times that code needs to be tested out in production by only a small set of users, this is where feature flags come in.

By using feature flags a developer is able to create a branch within their code, allowing that section of code to only execute for a specific user or set of users.  This provides several advantages; have users test out a new feature before being launched to everyone, allow for product managers to get feedback on a new feature while it is being developed and allowing for a quick rollback of a new feature if it causes performance issues or elevated error rates

The use of Feature Flags also helps support the development team in using trunk-based development as code can be created in a short running branch and then merged into main while hidden behind a feature flag and not available to any user until that feature is ready.  In this the developer is moving the branch from the version control system to the code, allowing for that code to be tested in production, and tested with other developers work without a complex branching strategy.

While Feature Toggles can be used in an application using a Feature Management tools that allow for feature grouping, user segmentation and controlled by different members of the team though an easy to user interface creates a collaborative environment for the entire team. In this Feature Flags are created by developers but are managed by the product team.

The use of user segments creates an environment where code can be easily tested in production.  Having a user segment just for the development team means that new features are visible to the team while they are testing out their features in production. Additional segments can be created for beta customers for early feedback.

The use of Feature Flags should be integrated into the development planning process.  When a new feature is discussed it should be asked if a feature flags should be used or if it should be part of an existing feature flag.  This is also where feature flag grouping can come in where different developers using different flags, but they can be turned on and off as a group, or individually as required, providing flexibility in the management of the flags and the user segments in which they are available for.

Feature flags can also be used to perform progressive rollouts of a new feature to all users by only allowing a certain percentage of the overall user base to see the new feature.  This gives the infrastructure time to add additional capacity if required and for the development team to see any new errors in the application.  If there is an issue then the feature rollout can be kept at a specific percentage or the new feature turned off completely, all without requiring a new release of the application.