Confidence
  • Documentation
  • Blog
  • Bootcamp
  • Status
  • Confidence Bootcamp
    • My learning
    • Intro to experimentation
      • Introduction
      • Lesson 1: Why you should experiment
      • Lesson 2: Experiment hypothesis
      • Lesson 3: Success and guardrail metrics
      • Lesson 4: Success metrics
      • Lesson 5: Set up your experiment
      • Lesson 6: Calculation frequency
      • Lesson 7: Target audience
      • Lesson 8: Sample size
      • Lesson 9: Quality assurance
      • Lesson 10: Run your experiment
      • Lesson 11: Evaluate your experiment and make a decision
      • Lesson 12: A/B tests and rollouts
      • Course wrap up
    • Intro to metrics
      • Introduction
      • Lesson 1: What is a metric?
      • Lesson 2: Metric roles
      • Lesson 3: Time considerations
      • Lesson 4: Capturing behavior
      • Lesson 5: Strategic metrics
      • Lesson 6: Interpretability
      • Lesson 7: Feasibility and sensitivity
      • Lesson 8: Variance reduction
      • Lesson 9: Select metrics
      • Lesson 10: Segment-level analysis
      • Course wrap up
    • Scientific product development
      • Introduction
      • Lesson 1: Why you should experiment
      • Lesson 2: The scientific method
      • Lesson 3: Randomized controlled trials
      • Lesson 4: Experiment hypothesis
      • Lesson 5: Case study
        • Case study
        • Answers to case study
      • Lesson 6: Why do we need statistics?
      • Lesson 7: Success metrics
      • Lesson 8: Detectable effects and sample size
      • Lesson 9: Make a decision
      • Course wrap up
    • A primer on hypothesis testing
      • Introduction
      • Lesson 1: Introduction to hypothesis testing
      • Lesson 2: True vs estimated effects
      • Lesson 3: Sampling distribution of the difference-in-means estimator
      • Lesson 4: Z-tests and how to reject the null hypothesis
      • Lesson 5: False postive rate and alpha
      • Lesson 6: True positive rate, MDE, and power
      • Course wrap up
    • Intro to Feature Flags
      • Introduction
      • Lesson 1: What is a feature flag?
      • Lesson 2: Lifecycle of a feature flag
      • Lesson 3: Clients
      • Lesson 4: Evaluation context and targeting
    • Sample size calculation - I
      • Introduction
      • Lesson 1: What is the required sample size?
      • Lesson 2: Alpha and power
      • Lesson 3: Baseline mean and variance
      • Lesson 4: Sample size playground - I
    • Sample size calculation - II
      • Introduction
      • Lesson 1: Multi-metric decision making
      • Lesson 2: Number of success metrics
      • Lesson 3: Number of guardrail metrics
      • Lesson 4: Number of comparisons
      • Lesson 5: Sample size playground - II
    • Sample size calculation - III
      • Introduction
      • Lesson 1: Binary metrics
      • Lesson 2: Treatment group proportions
      • Lesson 3: Variance reduction
      • Lesson 4: Sequential testing and sample size
      • Lesson 5: Sample size playground - III
    • Advance your experimentation
      • Introduction
      • Lesson 1: Guardrail metrics with non-inferiority margins
      • Lesson 2: Choose evaluation frequency
      • Lesson 3: Metrics' roles in experiments
      • Lesson 4: Cumulative holdback evaluations
    • Experimentation culture
      • Introduction
      • Lesson 1: Onboarding into experimentation
      • Lesson 2: Empowering experimentation champions
      • Lesson 3: Sustaining the experimentation culture
    • Videos

Lesson 2: Life cycle

Summary

This lesson covers the lifecycle of feature flags, from their creation to their eventual removal or archival. We'll explore how feature flags evolve alongside feature development, the differences in managing flags across backend, web, and mobile environments, and best practices for cleanup and reuse.

Feature flag evolution

During feature development, it's common to start with a single flag that controls all configuration for that feature. This flag can hide the feature until it's ready for release. Using the feature flag, you can remotely toggle the feature for yourself and selected colleagues during development. As development progresses, the flag evolves with the feature, and different properties may be added or removed. By the end, the flag might contain just a simple boolean 'enabled' property, or it might retain certain aspects that you want users to control through experimentation.

Example life cycle

To illustrate the life cycle of a feature flag, we will go step by step, from creation to removal, both in your experimentation platform and your app code.

Create a flag illustrated
  1. Create a flag

    • Create the flag in your experimentation platform
    • Add the flag to the app code
    • Test it with your team
    Parametrize the user experience illustrated
  2. Parameterize the user experience

    • Add properties to the flag and connect them to the feature
    • Set default values matching the current experience
    • Run A/B tests to optimize property values
    • Gradually roll out the winning variant
    Update default values illustrated
  3. Update default values

    • Update the app code with the new default values
    • Release a new app version
    • Wait for user adoption
    Remove a flag illustrated
  4. Remove the flag

    • Replace feature flag code with hard-coded values
    • Remove the flag from the experimentation platform
In Confidence

In Confidence, create the flag in the Confidence app (step 1) and remove it from the Confidence app when cleaning up (step 4).

Post-experimentation: Flag retention

After completing an experiment and rolling out the winning variant, you have three options:

  • Clean up the flag
  • Retain the 'enabled' property as a safety switch for quick feature disabling
  • Retain the full flag to enable future iteration

Consider these factors when deciding how long to keep a flag:

Code complexity and bundle size

Feature flags create conditional branches in your code ('if enabled'). Keeping these branches increases code complexity and bundle size.

Recommendation

While feature flags offer great flexibility, maintaining too many can lead to unsustainable complexity and increased bundle size, as we've learned at Spotify.

User experience after flag removal

For backend services, you control the code version in production. However, with mobile apps, you need to consider how removing a flag affects users on older app versions. You might want to maintain the flag until you achieve high adoption of the new app version, which can take several months for some apps.

Reader exercise

What should you do with a feature flag after an experiment is complete and the winning variant is rolled out?

Reader exercise

Why is it important to consider mobile app updates when deciding whether to remove a feature flag?

Was this page helpful?

PreviousLesson 1: What is a feature flag?
NextLesson 3: Clients

© Copyright 2026. All rights reserved.

Follow us on TwitterFollow us on GitHub

On this page

  1. Feature flag evolution

  2. Example life cycle

  3. Post-experimentation: Flag retention