Swiftorial Logo
Home
Swift Lessons
AI Tools
Learn More
Career
Resources

Release Engineering: Scenario-Based Questions

84. How do you design and manage feature flags in a production system?

Feature flags allow you to ship code continuously but release features selectively. They’re key to controlled rollouts, A/B testing, and safe experimentation β€” when implemented thoughtfully.

🚩 Types of Feature Flags

  • Release Flags: Turn features on/off post-deploy.
  • Experiment Flags: Enable A/B testing or canary cohorts.
  • Ops Flags: Temporarily disable behavior during incidents.

🧱 Flag Implementation Options

  • Boolean flags: Simple enable/disable.
  • Targeting rules: Enable for specific users, groups, or conditions.
  • Dynamic rollout: Gradually increase exposure by % or region.

πŸ› οΈ Tools & Services

  • LaunchDarkly, Unleash, Flipt
  • Homegrown flag services backed by Redis or config stores
  • CI/CD plugins for toggling flags during deploy

βœ… Best Practices

  • Externalize flags (no redeploy needed to change state).
  • Audit flag changes and restrict write access.
  • Set TTL or cleanup plans for temporary flags.
  • Use flag status metrics to detect partial failures or crashes.

🚫 Common Pitfalls

  • Leaving stale flags β€” creating tech debt and complexity.
  • Toggling flags without validating downstream dependencies.
  • Flag logic deep inside business logic β€” hard to test or remove later.

πŸ“Œ Final Insight

Feature flags turn code into controlled experiments. With safe toggling, metrics, and governance, they unlock continuous delivery without compromising safety.