In recent years, Feature Flags have become an indispensable part of a lot of companies, but what are they?

Feature Flags go by many names — Feature Toggles, Feature Switches, etc. But regardless of the name, they all refer to the same development technique.

This development technique essentially allows you to turn features on and off at the run time, without changing the code, just by turning on and off a switch on a third-party provider (you can of course implement your own Feature Flag Service)

Diagram with three boxes, one for third party provider that connects to request box that connects to code base box

High level concept view of Feature Flags

Let’s take a closer look.

First, we would need to define our new Feature Flag in our third-party provider.

This would differ from one service to the other, but imagine something like this.

The word new feature next to a switch

Next, we would need to make a request in our code that checks whether or not our Feature Flag is on or off.

const isNewFeatureEnabled = await getFeatureFlagFromThirdParty(newFeature)

And then we would take one path or another based on the result of said request.

if(isNewFeatureEnabled){
  newFunction()
} else {
  oldFunction()
 }

This provides a lot of advantages. Just by turning on and off a switch, we can execute one code or another.

Imagine you are now pushing new code to production, maybe a new Feature, with Feature Flags you can now feel much safer, should your new code cause the dreaded regression with just the turn of a switch you can go back to the way it was before.No need to rollback through complicated re-deploys.

And that’s just the tip of the iceberg, Feature Flag services come with many additional functionalities like being able to activate a code to a certain number of clients ( maybe you want to introduce the new Feature for just 10% of your user base), maybe you want to do A/B testing, etc.

#javascript #devops #programming #feature-flags #nodejs

What the Hell are Feature Flags?
1.90 GEEK