Professional Documents
Culture Documents
As any developer can tell you, deploying any code carries technical developed similar deployment capabilities as well. The feature
risk. Software might crash or bugs might emerge. Deploying features flag was philosophically fundamental to this development and set
carries additional user-related risk. Users might hate the new the standard for modern deployment maturity used by leading
features or run into account management issues. With traditional organizations everywhere today. Recently, feature flags have been
deployments, all of this risk is absorbed at once. Feature flags give used in tandem with continuous delivery (CD) tools to help forward-
developers the ability to separate these risks, dealing with one at a looking organizations bring features, rather than releases, to market
time. They can put the new code into production, see how that goes, more quickly.
and then turn on the features later once it’s clear the code is working
as expected. WHAT DOES A FEATURE FLAG
LOOK LIKE?
WHAT IS A FEATURE FLAG? The following is a simple feature flag in code used on an e-commerce
Simply put, a feature flag is a way to change a piece of software's site. This software displays a “Happy holidays!” greeting message
functionality without changing and re-deploying its code. Feature and an associated “see more holiday deals” call to action to a site
flags involve creating a powerful “if statement” surrounding some visitor when it is instructed to. The developer has a way to toggle
chunk of functionality in software (pockets of source code). this functionality on and off without re-deploying the code for every
holiday or across every instance where it should appear.
THE HISTORY OF FEATURE FLAGS
Leading Web 2.0 companies with platforms and services that must
maintain performance among high traffic levels led the way in
regard to developing and popularizing new deployment techniques.
Facebook, in particular, is known as a pioneer of feature flags and
for releasing massive amounts of code at scale. While building its
massive social network more than a decade ago, the company
realized that its uptime and scale requirements could not be met with
traditional site maintenance approaches. (A message saying the site
was down while they deployed version 3.0 was not going to cut it.)
1
REFCARD | GETTING STARTED WITH FEATURE FLAGS
It would have a construct like this for the top of a page: performs best. In the example of an e-commerce site, a brand might
test whether a green or red “buy” button results in more transactions.
if(feature.isActive("holiday-greeting")) {
print("Happy holidays," + user.name + "!"); The brand would deploy both buttons, use a feature flag to split
its user base in half, and see which color performs the best. The
}
possibilities for production experiments are endless, and the results
can significantly improve your application. When used correctly,
And then perhaps something like this at the bottom:
experiments provide product owners and developers with a much
if(feature.isActive("holiday-greeting")) { shorter feedback loop with their end users, resulting in improved
printLink("Click to see more holiday deals",
customer acquisition and retention.
"~/holidayDeals");
TURNING OFF FUNCTIONALITY WITH A KILL SWITCH Table 1: Types of feature flags
In the same way that organizations can increase the number of
CATEGORY LONGEVITY DYNAMISM
users who see a feature, they can also decrease that number to zero,
creating a kill switch. This capability comes in handy when a feature Release Days to weeks (until Changes with deployment or
the functionality is runtime configuration (turn
doesn’t behave as planned. Developers can roll back the change and
deployed) off in case of rollback
let life go back to normal for users. It’s also useful for sunsetting and requirement)
then decommissioning legacy features. Kill switches absorb much
Experiment Weeks to months Changes dynamically
of the risk, stress, and overhead from a release for developers as it’s (until the data is
simple to roll back a feature. sufficiently recorded)
2
REFCARD | GETTING STARTED WITH FEATURE FLAGS
ENHANCING TRADITIONAL across the greater CI/CD lifecycle. This scenario is a recipe for disaster
CONTINUOUS DELIVERY in larger organizations where there are many developers and new
Continuous delivery can be difficult to truly master in more complex features are being developed regularly. Feature flags can impact the
organizations. Feature flags provide guard rails for teams wanting entire CI/CD process, and development teams should be purposeful
to start or grow their current CD program. Feature flags can enable in how they incorporate them into their tools and processes.
Testing in production increases QA teams’ confidence that the operations, and shared services teams, feature development and
code will perform as intended in real environments. Flags also release can be expedited with the assurance that flags will not be
provide higher granularity of release to end users based on updated without the knowledge of all teams involved.
beyond focusing on the moving bits between different target create technical debt. This is an understandable sentiment since, if
environments to focusing on growing customer value with feature implemented by hand, they can lead to massive, ad hoc tangles
flags in continuous delivery. of conditional logic in the codebase. And that can be downright
nasty. Technical debt is one of the reasons why it can make sense to
Table 2: Traditional CD vs. modern CD with feature flags consider adopting a third-party management system. These systems
TRADITIONAL CD MODERN CD WITH FEATURE FLAGS can actually save you from technical debt, even as your own home-
rolled solution may cause it. But even with such a system, you have
Focused on delivering Focused on delivering features
releases to be careful.
3
REFCARD | GETTING STARTED WITH FEATURE FLAGS
it manually. They will develop an understanding of how it works and FEATURE FLAGS WILL BECOME
make better decisions later. But if they find themselves in over their STANDARD IN MOST ORGANIZATIONS
heads, remember that mature, third-party feature flag management While there are many considerations for adding feature flags into a
systems exist for a reason. software delivery lifecycle, the benefits of flagging most, if not all,
features are clear. As the methodology and platforms mature, feature
FEATURE FLAGS AT SCALE flags will become an integrated part of the software development
Many organizations start using feature flags with homegrown systems infrastructure, and there may be a time when every feature is
that their developers create. These can be effective for smaller teams released wrapped in a flag for maximum safety and velocity.
and companies. However, once a company is ready to scale their
feature flags across their organization and make them a staple of At the same time, organizations will move from “if” to “how” in
their continuous delivery efforts, they need to consider whether their regard to better automating and integrating flags into their strategy.
internal system will scale. Asking the following questions can help There is a maturity scale that should be considered for getting started
determine which approach is the best fit: with flags — from developing an internal system to most likely
choosing an external platform to manage flags and integrate with the
OVERHEAD greater SDLC.
How many hours a week am I willing to devote to maintaining my
If you are just getting started, it will be a journey, no question. But the
internal flagging system? Am I comfortable dedicating developer
benefits will be worth the effort.
hours to system maintenance and updates?
ANALYTICS
How will I ensure I'm getting feedback on my features accurately
and in real time? Do I want to maintain another analytics dashboard,
or do I want to integrate feature information into my current DZone, a Devada Media Property, is the resource software developers,
engineers, and architects turn to time and again to learn new skills, solve
dashboards? software development problems, and share their expertise. Every day,
hundreds of thousands of developers come to DZone to read about the latest
technologies, methodologies, and best practices. That makes DZone the ideal
DEVELOPER PRODUCTIVITY place for developer marketers to build product and brand awareness and
drive sales. DZone clients include some of the most innovative technology
Are my developers most productive using an internal system as-is, and tech-enabled companies in the world including Red Hat, Cloud Elements,
or would they benefit from using an external platform with reduced Sensu, and Sauce Labs.