Feature Flags Simply Explained

DevOps

16/08/2021


A great way to understand what feature flags are is by contrasting it to an alternative: feature branches 🌳.

The main purpose of feature branches is to keep the main branch clean and releasable at all times while having incomplete and unreleasable features in separate branches. Of course, this approach has its own pros and cons.

And then there are feature flags. 🚩

Working in master

In a way, they are the opposite of feature branches: every developer is working in the master branch. However, incomplete features are "toggled" off so that they don't appear in production. This toggle is what's often referred to as a feature flag or feature toggle.

As an example, imagine you're working on some sort of widget for a webpage. 💻 Its feature flag is nothing more than an if statement that one can configure using an environment variable.

TEXT
if env.WIDGET_ACTIVE: showWidget() # Pseudocode

This allows you to dynamically switch on 💡 the feature at a later date once it's ready without having to redeploy the entire application.


WRITTEN BY

Code and stuff