Skip to main content

What are Feature Flags?

· 6 min read

A guide on feature flags key concepts and how to use them.

A feature flag is a software development practice used to launch new features, without deploying new code. It decouples deployment lifecycle from product launches and allows software to be tested in production without impacting customers.

A feature flag is a control switch to turn on/off software experiences.

How does it work?

Let's take an analog world example, imagine a living room with a light bulb and a wall switch.

There are 3 components needed for the light to turn on. A switch button to set the light state to On/Off, the light bulb that displays the state and the electrical wire between them.
In a broader sense this is a state machine with a control interface to set the state, an object that receives that state and the communication layer between components.

A feature flag works like a light switch but for code.

High level

Like in the light bulb example, there are 3 components in a feature flag setup.

It starts with the code (a webapp, microservice or mobile app) that will react to the flag state. There is a flag management service with a GUI, like Remote Flags, to setup and control flag state. Finally there is the connection between the service and the code, this can be an API call or an event driven workflow (e.g. webhooks)

featureFlagButton.png

With this setup, you can write code to execute actions on specific flag status, for example change a product price in an e-commerce website. Then you can change code remotely, simply changing the flag state in Remote Flags GUI.

Feature flags are state placeholders, that can be integrated in code and controlled remotely. They allow instant code behaviour changes.

Putting pieces together

Imagine you want to release the next big thing on your mobile app with code name A.

  1. Define a On/Off feature flag on Remote Flags.

    featureFlagDefine.png
  2. Integrate the flag in your code.
    2.1. Use an if statement over the flag state and put new feature code inside it. This way, you ensure that for a specific flag value (On/Off), only the matching code path is executed (render A or B).
    2.2. Deploy a new app version, containing the new feature gated by your flag.

    featureFlagIntegrate.png
  3. Control your code behaviour.
    3.1. When you decide to launch the new code path A, just set the flag status to On. whatFeatureFlagIsSetFlag.png 3.2. This will make your users see the new experience A instantly on their mobile apps. whatFeatureFlagIsRender.png

But wait, there is more!

Once you have a feature flag setup, you have a gated path to safely perform code changes on the new feature, perform QA testing and Beta testing with early adopters, without all your users seeing it. Furthermore, after launching, in the event of some issue with the new feature, you can as easily set the flag status to Off and restore your app to a good state instantly, for all the users, without a new app deployment or release!

What pain points are feature flags addressing?

Software deployment might seem a straightforward operation but...

  • Is usually performed by tech people, such as developers or release managers
  • If a business person considers that "now" is the correct moment to launch a new promotion or introduce a behavior change, they depend on a development team for that launch.
  • If teams are off-work, the deploy might need to wait several hours or even days, resulting in missed opportunities or revenue losses.
  • Deploy time depends on software complexity and might take several hours or even fail with a need to restart
  • If a new version launch introduces a bug, an old version needs to be re-deployed, taking hours or days.
  • The impact might be severe, such as having systems offline, exposing customer data or affecting customers experience for a long time.

A feature flag offers instant control to timely and confidently launch software without the before mentioned pain points. The process can also allow controlled launches with gradual dial-ups of features or targets, and immediate rollbacks if an issue occurs, minimizing launch risks and business impact.


Different feature flag types and applications

Features flags are used in software development lifecycle and require configuration from development teams. However, they are not an exclusive tool of DevOps teams, they can also be leveraged in other scenarios by Business teams like product managers, sales or marketing teams.

Technical Feature Flag
  • Focus on controlling new version deploys (and rollback) to avoid or reduce impact of eventual bugs on business performance.
  • Used to measure performance impact of new features.
  • Managed by developers and delivery managers.
Business Feature Flag
  • Focus on controlling software behavior, timely launches, geographic or user type options of software experience.
  • Managed by business personas, product managers, etc.
  • Easy and simple to use UX, enabling precise control on how the software follows market behavior.

Why should I use Remote Flags and not build an in-house solution?

As in all companies, resources are limited, and today, in a competitive market where developers are scarce, investment in the company’s core business typically provides a better return.

A company focused on e-commerce will better benefit from using its manpower to create new product capabilities that increase sales, such as: new promo-code input, rather than focusing on building a side tool to support one of the internal processes; improve the checkout service instead of creating an interface to change flags; create a new size & fit tool instead of creating a system that helps on controlled deploys.

To complement, while building an in-house one-off solution for feature flags might seem like a long-term investment, its features will quickly become limited to what the business needs to evolve, while also requiring support for its use, proving to be just another product, outside the core business that requires internal investment.

By using Remote Flags, you will see a product that is constantly evolving, providing new features that all your users can take advantage of, while focusing your resources on what truly matters.