Skip to main content
What is a Feature Flag?
  1. Glossary/

What is a Feature Flag?

7 mins·
Ben Schmidt
Author
I am going to help you build the impossible.

Building a startup often feels like trying to repair an airplane while it is mid flight. You want to add new capabilities to your product to satisfy users and stay ahead of the competition, but every time you push new code to your servers, you risk breaking everything. This tension between the need for speed and the need for stability is where many founders get stuck. Feature flags are a technical solution to this specific business problem.

At its simplest level, a feature flag is a conditional statement in your code that allows you to turn a specific piece of functionality on or off at runtime. This means you can change how your software behaves for your users without actually deploying any new code or restarting your servers. It is a way to separate the act of putting code into a production environment from the act of making that code visible to your customers.

Understanding the Basics of Feature Flags

#

A feature flag is often referred to as a feature toggle. Think of it like a light switch in a room. The wiring is all behind the wall and the power is flowing, but the light only turns on when you flip the switch. In a software context, your developers write the code for a new feature and wrap it in a logic gate. If the flag is set to true, the user sees the feature. If the flag is set to false, the code exists on the server but remains dormant and invisible.

This technique is fundamental for startups that want to practice continuous integration and continuous delivery. Instead of waiting weeks to finish a massive feature before merging it into the main code base, developers can merge small chunks of unfinished work safely. They simply keep the feature flag turned off until the entire project is ready. This keeps the development pipeline moving and prevents the nightmare of massive, conflicting code merges that often happen right before a big launch.

For a founder, this provides a level of control that is traditionally missing from the development process. You do not have to be a coder to understand the value of being able to instantly disable a broken feature. If a new update causes your checkout page to crash, you do not have to wait for a developer to find the bug, fix it, and redeploy. You simply flip the switch to off, and the site reverts to its previous stable state.

The Technical Mechanics of Runtime Control

#

To implement feature flags, a development team usually uses a configuration file or a dedicated feature management service. When the application runs, it checks the state of these flags. This check happens in real time. Because the logic is handled at runtime, the behavior of the application can be updated instantly across all users or a specific subset of users.

There are several ways these checks are managed:

  • Hard coded configuration files that require a small update to change.
  • Database entries that the application queries periodically.
  • Third party services that provide a dashboard for non technical team members to manage flags.

Using a third party service is often the preferred route for growing startups. It allows product managers or even customer support leads to manage feature access without bothering the engineering team. This shift in responsibility can significantly increase the operational velocity of a small company.

However, it is important to realize that every flag adds a layer of complexity. You are essentially creating multiple versions of your product that exist simultaneously. This leads to questions that every founder should ask their technical team. How are we testing the different combinations of flags? What happens if two flags conflict with each other? These are the types of unknowns that require careful planning as your system grows.

Strategic Advantages in a Startup Environment

#

In a startup, your biggest enemy is often uncertainty. You do not know if a new feature will be a hit or if it will confuse your users. Feature flags allow you to conduct experiments to gather data before committing to a full rollout. This is a scientific approach to product development that moves away from gut feelings and toward evidence based decision making.

  • Risk mitigation: You can release a feature to only one percent of your users to see if it causes any server errors.
  • Beta testing: You can enable a feature specifically for a group of power users to get feedback before the general public sees it.
  • Dark launching: You can push code to production to see how it affects system performance without making the UI visible to anyone.

These strategies allow a small team to act like a much larger one. You can maintain a high pace of innovation while keeping the blast radius of any potential failure very small. It changes the culture of the company from one of fear regarding deployments to one of confidence.

Comparing Feature Flags to Code Branching

#

It is common to confuse feature flags with code branching in systems like Git. While they are related, they serve different purposes. Branching is a way for developers to organize their work and keep different versions of the code separate while they are being written. A branch lives in the development environment.

A feature flag, conversely, lives in the production environment. Branching helps you manage how code is written, while feature flags help you manage how code is experienced. If you rely solely on branching to manage features, you end up with long lived branches that are difficult to merge back into the main line. This is often where technical debt begins to accumulate.

Feature flags encourage developers to merge their code into the main branch as often as possible. By using flags to hide incomplete work, the team ensures that the main branch is always in a deployable state. This reduces the risk of the integration hell that many startups face as they scale their engineering teams.

Practical Scenarios for Implementation

#

There are specific moments in a company life cycle where feature flags become indispensable. One such scenario is the sunsetting of old features. When you want to remove a feature that some users still rely on, you can use a flag to slowly hide it from new users while keeping it active for old ones. This allows for a graceful transition rather than a jarring change.

Another scenario is managing infrastructure migrations. If you are moving from one database provider to another, you can use a feature flag to pipe a small percentage of traffic to the new database. This allows you to monitor the new system performance in a real world setting without risking the entire business on a single switchover event.

Finally, consider the kill switch scenario. Every startup will eventually ship a bug that affects the bottom line. Whether it is a pricing error or a security vulnerability, having a pre built kill switch for that specific module can save the company. It is a form of insurance that you hope you never have to use but are glad to have when things go wrong.

Managing the Hidden Costs of Flags

#

While the benefits are clear, feature flags are not free. They carry a cost in terms of technical debt. Every flag you add creates a new path in your code. If you do not remove flags after a feature has been fully rolled out, your code base becomes littered with old logic and dead paths. This makes the system harder to understand and maintain.

A founder should ensure there is a process for flag cleanup. Who is responsible for removing the flag once the experiment is over? If the flag stays in the code for two years, does anyone remember what it actually does? These are the practical realities of maintaining a healthy software system.

You should also consider the performance impact. Each time a flag is checked, it takes a tiny amount of processing power. In a high traffic environment, millions of flag checks can add up. It is a trade off between the flexibility of the flag and the efficiency of the code. Finding the right balance is an ongoing conversation between the business needs and the engineering constraints.

How do you decide which features deserve a flag and which ones are simple enough to ship directly? This is a question with no universal answer. It depends on your team size, your risk tolerance, and the complexity of your product. By understanding what feature flags are and how they function, you are better equipped to lead those discussions and build a more resilient business.