Product
|
Cloud costs
|
released
November 17, 2021
|
3
min read
|

How to Get Started With Feature Flags

Updated
10/4/2023

Getting started with feature flags is fast and easy - especially compared to a lot of developer tools that can take more time to integrate into your workflow. 

You can usually find one or two easy wins with feature flags and get them working with just a few commands. Before diving into that though, let’s look at how to best plan ahead.

This article contains an excerpt from our eBook, The Basics: Feature Flags 101. If you like the content you see, stick around to the end where we’ll link the full eBook for you.

Before Getting Started

Before getting started, we recommend you have a brief discussion with your team to outline a good initial use case for feature flags, whether it be to conduct progressive delivery or improve your user experience. Some common ones are:

  • Show or hide a button to access a new feature;
  • Test a UI change;
  • Try a new call to action to see how it performs; 
  • Let users opt into an experimental use case.

Once you have picked a good initial use case, the next conversation to have is where you’ll create a flag - meaning primarily in the front end, the back end, or a mix? The reason for this is because feature flags use SDKs you install in your code, and you’ll use different SDKs depending on the language of each service.

Your First Feature Flag

Once you’re ready to implement an initial feature flag, there are only three key steps, conceptually:

  1. Install the SDK;
  2. Create and code the flag;
  3. Set up your flag rules.

You can go here for more detailed implementation instructions using Harness Feature Flags specifically, but we’ll first look at this at a higher level in this eBook.

Installing the SDK is as simple as picking the right language. Harness breaks down SDK types between server and client, as client SDKs will run in the user’s session, while server SDKs will live in your application and evaluate entirely locally.

SDKs supported by Harness Feature Flags

Next, creating and coding the flag is really just a fancy if statement - wrapping the different code paths you want the different states of the flag to evaluate.

Code to Add Individual Target and a Target with Attributes
Example of creating a flag in java

And, finally, creating the flag rules. If you’re not sure what that means, think of it this way: your feature flags get applied to end users of your application. We call those targets, other systems may call them users or sessions.  

Those targets have attributes that you define, such as email, licensing plan, location, or other custom characteristics. You can then use those attributes to decide which flags to serve them. For example:

  • Show the true state of our “New UI” flag to all users in Texas;
  • Show the 14 Day Trial state of our “Special Offer” flag to all users on the free plan;
  • Lastly, show the true state of our “New Offer Test” flag to all users globally, but turn it off tomorrow so we can review the data.

You have flexibility in designing these scenarios, because you can pick any attributes you want to be used for this type of targeting.

But, you can also keep it simple and enable or disable the flag across your entire application as well. This is great for launching new features - instead of a whole new deployment coordinated with your marketed press release time, just turn the flag on. Anyone can do it, and your engineers can keep working on the next big thing!

Harness Feature Flags Dashboard with Toggles to Turn Flags On and Off
Managing feature flags in Harness

Conclusion

You’ve now seen how easy it is to get started with feature flags. Whether you’re looking to build something yourself or use a tool, we hope the information here has made it easier to understand the prerequisites and how to start on a solution. As we’ve stressed in the past - and continue stressing, feature flags pack a punch!

Whether you find yourself trying to solve a pressing problem in your software delivery process, to get more control over your customer-facing application experience, or to get ahead of the game and see how you can better leverage technology, feature flags can greatly impact how you approach software delivery and the effect it will have on your users.


Are you ready to learn more about feature flags? If so, download the full eBook here: The Basics: Feature Flags 101.

Sign up now

Sign up for our free plan, start building and deploying with Harness, take your software delivery to the next level.

Get a demo

Sign up for a free 14 day trial and take your software development to the next level

Documentation

Learn intelligent software delivery at your own pace. Step-by-step tutorials, videos, and reference docs to help you deliver customer happiness.

Case studies

Learn intelligent software delivery at your own pace. Step-by-step tutorials, videos, and reference docs to help you deliver customer happiness.

We want to hear from you

Enjoyed reading this blog post or have questions or feedback?
Share your thoughts by creating a new topic in the Harness community forum.

Sign up for our monthly newsletter

Subscribe to our newsletter to receive the latest Harness content in your inbox every month.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Feature Flags