Implementing feature flags essentially allows you to decouple your code deployment from your feature releases. Picture the following scenario.
You are working on a new feature which your product team is eagerly waiting for. They have set a launch date for the 15th of the month and you’re working hard to iron out all the kinks before the big launch.
You finally feel your software is ready to be released, you arrange with your deployment team to have your new code deployed to production on the evening of the 14th ready for the big launch the following day.
Once it’s released you test and find things are not working as expected! You then spend a very stressful and sleepless night trying to fix everything before the morning.
If the situation described above is something you’ve experienced before or even worse are experiencing on a regular basis, then feature flags are what you need.
Now picture the same product launch scenario that’s described above but this time you have added feature flags to your development process.
Because we now have the ability to turn a price of code in our application on and off at will without the need to redeploy our code we can completely eliminate the need to deploy the new feature on the 14th, the night before the big launch. We can instead do the code deployment days or even weeks before the actual launch, it’s not seen by the customers because the feature flag is turned off. Releasing the new feature on the day of the big launch is as simple as the click of a button!
Using feature flags to decouple your software deployments from your feature releases is a very powerful technique. Luckily Floodgate makes implementing such a technique simple.
Another powerful feature of feature flags is the ability to test out your new features in production. Testing in production may seem like a strange idea when you first hear about it, testing is usually done in a test environment and never a production environment right? Well not anymore!
Because we have our code wrapped in a feature flag and we have the ability to turn that feature on and off with ease we can also make sure of something called User Targeting and Percentage Rollouts, also known as Canary Releases.
Once we have our code released to production with the feature flag turned off, we can use Floodgates User Targeting and Percentage Release features to turn on the feature flag for either specific users or a percentage of users.
For example at Floodgate when we are working on a new feature for release we will enable that feature for all users with the @floodgate.io email address. This allows us to see how the new feature performs in production and allows us to fix any bugs which may crop up before we roll the feature out to a wider audience. Once we are happy that the feature is working as our internal team expect we enable Floodgates Percentage Rollout feature and give access to the new feature to a percentage of our customers.
As you can see, applying the release process described above is another powerful way to reduce the risk of your deployments. It allows you to completely eliminate the “Big Bang” release method which is usually a very high stress event high incident event.
Now you have a good idea of what is a feature flag and the benefits of using them can bring. Let’s discuss how easy it is to include feature flags in your software.
Here is an example code snippet for adding a Floodgate feature flag into a C# application.
In just 8 lines of actual code and you have your first feature flag implemented and ready to use – it really is that easy!