Feature Flags

The Art of the IF and Deployment

Chris Ayers

Senior Customer Engineer
Microsoft

Twitter: @Chris_L_Ayers
Mastodon: @Chrisayers@hachyderm.io
LinkedIn: - chris-l-ayers
Blog: https://chris-ayers.com/
GitHub: Codebytes

Agenda

  • What are Feature Flags?
  • Why use Feature Flags?
  • Operationalizing Flags
  • Demos

What is a Feature Flag?

Feature Flags are also known as Feature Toggles.

Feature flags can be simple configuration settings with Boolean, string or other values.

What Are Feature Flags?

Lets find out

  • Booleans in the code
  • Config values checked in


Basics

bool featureFlag = true;
if (featureFlag) {
    // Run the following code
}

What Are Feature Flags?

Dynamic toggling based on some information and rules



Dynamic

bool featureFlag = isBetaUser();

if (featureFlag) {
    // Run the following code
}

Why Use Feature Flags?

Feature Flags have different uses

Minimize Disruption to Customers

Progressive / Incremental Rollouts

A/B Testing - Hypothesis Driven Development

Kill Switch

Calendar Events

Feature Flags have different uses

Allow Users to Opt In

Block Users

Subscriptions

Advanced Users

Maintenance Mode

Load Management

Code Separation

Sunset / Shut Off

Not all Flags are the same

Short Term

  • These are used to roll out new features or conduct experiments.
  • They can be found anywhere, and can be more complex.
  • They should be cleaned up after the rollout or experiment.

Not all Flags are the same

Long Term

  • Features can start out as flags and become business rules.
  • Feature flags can turn into Operational Flags.
  • You can leverage patterns instead of just an if statement
    • Strategy Pattern
    • Visitor Pattern
    • Command Pattern

Operationalizing Flags

Deployment vs Release

Deploy

  • Low Risk, repeatable and routine
  • Installed on Production
  • Doesn’t mean features are in use

Release

  • Higher Risk
  • Business decision
  • Enables access to a feature
  • Allows experimentation

Limit the Blast Radius of Change

Its all about control

How do you turn it on and off?

  • Per checkin?
  • Per server?
  • Per user?
  • Dynamically?

Flag Targeting



Targeting Percentages Triggers
Time
Region
User Details
10%/90%
50%/50%
Rise in failures
Load

Feature Flag Downsides

Flag Best Practices

  • Have a naming convention for short or long term flags
  • Use meaningful names with long descriptions
  • Have a central location for flags, one place to look at available flags
  • The development team should share flags and configurations at the end of a sprint so that the right configuration is released.
  • NEVER re-purpose a feature flag
  • Deprecate unused features and their flags

Knight Capital and Feature Flags

  • In 2012, Knight Capital Group suffered a trading loss of $440 million in 45 minutes due to a software glitch.
  • The glitch was caused by the release of new software code that was not fully tested before being deployed to production.
  • The code included an old feature that had been previously disabled, but was inadvertently reactivated by the new release.

DATA - SQL/JSON Models

  • Be additive, never change existing fields
  • If you have to remove a field, obsolete it until there is no possibility of rollback
  • Separate the data model from the business logic

Feature Flag Providers

  • Azure App Configuration
  • Launch Darkly
  • Split
  • Optimizely
  • Molasses
  • Flagship
  • GrowthBook
  • Apptimize
  • Taplytics
  • Harness

OpenFeature

OpenFeature is an open standard for feature flag management. OpenFeature provides a unified API and SDK, with extensibility for open source and commercial offerings.

https://openfeature.dev/

Demos

Questions

Resources