Problem Statement
What are feature flags (feature toggles)?
Explanation
Feature flags (toggles) are conditional switches controlling feature visibility at runtime without code redeployment. Code deployed with feature disabled, flag flipped to enable for specific users/environments. Enables: deploying code before ready, gradual rollout, A/B testing, instant rollback, environment-specific features.
Types: release toggles (temporary, removed after launch), ops toggles (operational control like circuit breakers), experiment toggles (A/B testing, analytics), permission toggles (user-based features). Example: if (featureFlags.newCheckout) { showNewCheckout() } else { showOldCheckout() }.
Tools: LaunchDarkly, Split, Unleash, custom implementations. Best practices: clean up old flags, document flag purpose, limit flag count, use consistent naming, implement flag expiry. Use cases: gradual rollouts, testing in production, emergency kill switch, personalization. Understanding feature flags decouples deployment from release.
