How to Use Feature Flags

Complete Developer Podcast - A podcast by BJ Burns and Will Gant - Thursdays

Categories:

“Flags allow us to restrict features to certain environments, while still using the same code base on all servers.” ~ Ross Harmes Feature flags offer an alternative to maintaining multiple various branches of source code. Continuous deployment requires such feature branches to be integrated with the master branch as early as possible. Feature flags are toggles that allow for early integration with execution paths turned off by a toggle that can be turned on for specific users/testers or when the feature is ready for deployment without having to roll out new source code. There are two basic types of feature flags: release toggles and business toggles. Release toggles are used for rolling out new features in continuous deployment. Business toggles allow for restricted user access such as through premium accounts. The simplest feature flags are boolean statements however they can be more. State can be set statically or dynamically. Rule based toggles can be used with XML, YAML, and JSON. Beyond common usage they are also available for trial of new features to allow early access to beta testers, allow internal review of the feature, or run A/B tests. When rolling out new features toggles can be used to verify scalability of the feature or app. Toggles should show a minimal presence in code and be retired once pending features are added. Dangers of using feature flags include accidental exposure of the feature, corrupting data, and technical debt created by the toggles. Episode Breakdown * 10:55 What are Feature Flags “The basic idea is to have a configuration file that defines a bunch of toggles for various features you have pending. The running application then uses these toggles in order to decide whether or not to show the new feature.” ~ Martin Fowler Feature flags also known as toggles are switches in code that grant or deny access to different features of an app. They make it so that features in development or testing can be part of the overall app without making into the end user experience. * 13:27 Types of Feature Flags Feature flags can be divided into two basic categories; release toggles and business toggles. Release toggles are used when a new feature is under development or to roll out or roll in features. Business toggles restrict user access to areas of an app and can be based on user experience or payed accounts. * 16:16 7 Lesser Known Uses of Feature Flags * More than Just Boolean Statements Toggle state can be set statically or dynamically. Flags can be rule based toggles using XML, YAML, or JSON to define conditions for flipping the toggle. * Enable Features for Specific Users In more long term usage feature flags can enable paygate or opt in options. They also allow unruly users to be blocked or restrict access based upon user experience level. * Trial of New Features for a Sample Set Toggles allow for split or A/B testing and give the opportunity for early access to certain users. They can also be helpful when beta testing new features to allow users to opt in to the beta version. * Internal Review of Features GitHub is a prime example of the use of internal review with their “staff mode” allowing staff access to features not yet in deployment. This allows the team to give feedback of the feature as it behaves in production. * Scalable Roll Outs Scalability becomes an issue when rolling out new features. Toggles allow for phased roll outs to identify issues in scaling the feature. * Maintenance Kill switches allow for features to be rolled back if issues arrise. Toggles may also be used to create a maintenance mode for updates and bug fixes. * Sunset Old Features The prime way to do this is to toggle the feature off for any new users then slowly transition the c...

Visit the podcast's native language site