Feature flag development: Controlling functionality without deployments
Feature flags (also known as feature toggles or feature switches) are a software development technique that allows teams to turn functionality on or off without deploying new code. At their most basic, feature flags are conditional statements in your code that determine which code path to execute at runtime.
For example, imagine you’re building a new checkout process for an e-commerce site. With feature flags, you could deploy the code but only enable it for internal testing teams initially, then gradually roll it out to customers while keeping the old checkout system available as a fallback.
The primary benefits of feature flags include:
- Decoupling deployment from release, enabling continuous deployment while controlling when users see new features
- Reducing risk by allowing gradual rollouts and instant rollbacks
- Enabling experimentation and A/B testing in production environments
- Supporting trunk-based development by allowing incomplete features to be merged into the main branch
- Providing kill switches for rapid incident response
TL;DR
- Feature flags let teams enable or disable functionality without redeploying code.
- Feature flags support progressive delivery methods, experimentation, A/B testing, and trunk-based development.
- Feature flag development uses conditional checks, remote configs, and SDKs to enable dynamic, customizable feature control.
- Purpose-built platforms like Unleash reduce maintenance and improve scalability compared to homegrown solutions.
How feature flag development works
Feature flag development is built on a simple concept: conditionally enabling or disabling functionality at runtime. At its core, this involves a basic check in your code, such as:
if (featureIsEnabled(‘new-checkout’)) {
// Execute new checkout logic
} else {
// Fallback to old checkout flow
}
Flag configurations can be stored locally in configuration files or managed through a remote service for dynamic updates without redeploying code. To simplify this process, most implementations rely on SDKs that handle fetching flag states, evaluating conditions like user segments or rollout percentages, and exposing an easy-to-use API for developers. While many flags return simple boolean values (on/off) like true/false, they can also deliver more complex configurations, such as JSON payloads that define UI variations or thresholds, enabling highly customizable behavior.
Why build vs. buy matters
Many organizations begin their feature flag journey by building homegrown solutions. However, as Mark Quigley from Wayfair noted: “We flipped the most important flag we could when we went from our in-house system to Unleash. Right away we found that it was scalable, highly performant, resilient out of the box. And Unleash ended up being 1/3 the cost of our homegrown feature flag solution, while also improving the reliability and scalability of our platform.”
A purpose-built solution like Unleash offers several advantages over in-house systems:
- Reduced maintenance burden
- Comprehensive feature set and SDKs across languages and frameworks developed based on industry best practices
- Enhanced reliability and performance
- Better developer experience
- Stronger security and compliance controls
Consider a team that built their own feature flag system but now spends 20% of their development time maintaining it instead of building new product features. Switching to a dedicated solution could free up that time while providing more robust functionality.
Feature flag development with Unleash
Unleash provides developers with an intuitive platform for implementing and managing feature flags. Here’s how it works:
Implementation process
- Install the Unleash SDK: Unleash supports numerous programming languages and frameworks including JavaScript, Java, Go, Python, .NET, and more.
- Create a feature flag: Define a new feature in the Unleash UI, providing a name, description, and default state.
- Implement the flag in code: Add conditional logic using the Unleash SDK, e.g. if (unleash.isEnabled(‘new-feature’)) { // New feature code} else { // Old implementation}
- Configure rollout strategies: Unleash offers various activation strategies:
- Gradual rollout (percentage-based)
- User targeting (specific users or groups)
- Environment-specific releases
- A/B testing configurations
For instance, you could set up a rollout strategy that first enables a new recommendation algorithm for 5% of users, monitors performance, then gradually increases to 100% if metrics look good.
Advanced features for enterprise development
Unleash distinguishes itself with enterprise-ready capabilities that address the needs of large organizations:
Security and compliance
As Jason Crow, Lead Principal Architect at Total Wine & More, mentioned: “What appealed to us about Unleash was the central control via the Admin Console, as well as the security posture of running the entire infrastructure under our own architecture and standards.”
Unleash offers:
- Role-based access control (RBAC)
- Detailed audit logs
- Change request workflows
- Data privacy controls ensuring user data never leaves your environment
- Support for air-gapped and FedRAMP requirements
Scalability
Unleash is designed for high-performance environments:
- Low-latency flag evaluations
- SDK side caching to minimize network overhead
- High availability architecture
- Support for multi-region deployments
Developer experience
Good developer experience is critical for adoption. Unleash provides:
- Intuitive UI for feature management
- Comprehensive documentation
- Language-specific SDKs
- Integration with existing CI/CD pipelines
- API-first design for automation
Common use cases for feature flags
Feature flags are far more than simple on/off switches. Feature flags control feature availability at runtime. Two of the most impactful use cases for feature flags are canary releases and A/B testing.
Canary Releases
A canary release is a strategy where a new feature or version is rolled out to a small subset of users before a full rollout to the entire user base. Feature flags make this possible by targeting specific user segments or allocating a percentage of traffic to the new feature. This controlled rollout allows teams to monitor performance, gather feedback, and mitigate risk before exposing changes to the entire user base.
A/B Testing
A/B testing compares two versions of a feature to determine which performs better. Feature flags enable this by serving different variations to different user groups without deploying separate codebases. By tracking key metrics such as conversion rates and engagement, teams can make data-driven decisions about which version to adopt, ensuring that changes improve user experience and business outcomes.
Best practices for feature flag development
To maximize the benefits of feature flags while minimizing potential drawbacks, follow these best practices:
Flag lifecycle management
- Plan for removal: Establish a process for removing flags once they’re fully released to prevent code bloat. For example, set up a quarterly review where your team identifies flags that can be removed, or automate alerts for flags that haven’t changed state in 90+ days.
- Use naming conventions: Adopt consistent naming that indicates the flag’s purpose and scope.
- Document flags: Include descriptions and business context for each flag to help team members understand their purpose.
- Set expiration dates: Define when temporary flags should be removed to prevent accumulation of technical debt.
Architecture considerations
- Flag granularity: Determine the appropriate level of granularity – too many flags increase complexity, too few limit flexibility.
- Performance optimization: Use local caching to minimize latency impact of flag evaluations.
- Default values: Always specify default behaviors for when the flag service is unavailable.
- Testing strategy: Develop a comprehensive testing approach for all flag states.
Organizational practices
- Cross-functional collaboration: Involve product, QA, and operations teams in feature flag decisions.For instance, create a weekly feature flag review meeting where engineers, product managers, and QA discuss upcoming flags, those ready for wider release, and those that can be retired.
- Establish governance: Define clear ownership and decision-making processes for flag management.
- Monitoring and analytics: Track flag usage patterns and impact on system and business metrics.
Real-world impact
Organizations using Unleash have achieved significant improvements in their development processes:
Truls Jørgensen, Principal Engineer at the Norwegian Labor and Welfare Administration (NAV), shared their transformation: “Before 2016, NAV used to take pride in 4 huge, coordinated, massive releases per year. As of today, this number is over 1400 times per week, which translates roughly to once every other minute.”
Henning Støverud, Chief Architect at Talentech, noted: “By deploying more frequently, the size of each deployment has been drastically reduced and new functionality can be tested early and more gradually thanks to Unleash and feature toggles.”
FAQs about feature flag development
How do feature flags decouple deployment from release?
Feature flags separate the act of deploying code from the act of releasing a feature to users. This allows development teams to merge and deploy new code continuously (even if a feature is incomplete) by keeping it hidden behind a flag. The feature can then be activated for specific users or all users at a later time, providing precise control over the release process without requiring a new deployment.
What is feature flag lifecycle management?
Feature flag lifecycle management is the process of creating, maintaining, and eventually removing flags from the codebase to prevent technical debt. It involves establishing clear naming conventions, documenting the purpose of each flag, and setting a plan for retirement once the feature is fully rolled out or deprecated. A strong lifecycle strategy ensures the codebase remains clean and manageable as new features are developed.
How do feature flags support trunk-based development?
Feature flags are a key enabler of trunk-based development. By using flags, developers can merge unfinished features into the trunk without affecting the stability of the application. This avoids the complexity and merge conflicts associated with long-lived feature branches and supports a more streamlined continuous integration pipeline.
What are common rollout strategies used with feature flags?
Common rollout strategies include:
- Gradual rollouts. A feature is released to a slowly increasing percentage of users to monitor performance and impact
- Targeted rollouts. A feature for specific user segments is enabled based on attributes like location, subscription plan, or user ID for beta testing.
These controlled approaches minimize risk and allow teams to gather feedback before a full launch.