agile3
Engineering Practices

Feature Flags

Switches in code that turn features on or off without deploying again.

2 min read · Practitioner

In 30 seconds

  • Ship code switched off, turn it on when ready.
  • Enable gradual rollouts, experiments and quick rollback.
  • Old flags become debt; remove them once done.

Types of flags

TypeUseLifespan
ReleaseHide unfinished featuresShort
ExperimentA/B testsShort
OpsKill switch for risky featuresMedium to long
PermissionFeatures for certain usersLong

This categorization is from Pete Hodgson's widely cited article on feature toggles.

What flags enable

Avoiding flag debt

  • Give every flag an owner and expiry date
  • Remove release flags soon after full rollout
  • Keep a list of active flags

Myth vs reality

Myth · Flags are free.
Reality · Each one adds a code path to test and maintain.
Myth · Flags replace testing.
Reality · Both flag states need testing.
Myth · Flags are only for big companies.
Reality · A simple config switch is a flag.

FAQ

Should we build or buy a flag system?

Start simple; buy when you need targeting and analytics.

How many flags is too many?

When nobody knows what they all do.

What's a kill switch?

An ops flag that turns off a feature instantly if it misbehaves.