Published in


Feature flags and why you should use them

You just wrote a great deal of code and are about to deploy it. But you ask yourself: “Will you set the hamsters free to eat all our servers?”

def get_homepage_content(request):
if feature_flags.enabled(‘new_homepage’, request):
return new_homepage(request.user)
return homepage_content(request.user)

How are Feature Flags helpful to you?

Implementing feature flags

Classifying feature flags

Release flags

Experiment flags

Ops Flags

Permission toggles

Considerations while implementing feature toggles

Separating decision points from decision logic

def generate_report(query):
if feature_flags.enabled('v2_release'):

# ...

if not feature_flags.enabled("v2_release"):
# do some deprecated work.
def performance_data_enabled():
return feature_flags.enabled("v2_release")

def query_source_table():
return not feature_flags.enabled("v2_release")

def generate_report(query):
if report_features.performance_data_enabled():

# …

if report_features.query_source_table():
# do some deprecated work

Embracing Inversion of Control

class V1ReportGenerator:
def generate_report():
# do work

class V2ReportGenerator:
def generate_report():
# do more work

def create_report_generator():
if feature_flags.enabled("v2_release"):
return V2ReportGenerator()
return V1ReportGenerator()

Storing feature flag data

Managing overrides

Working at Toplyne

Join the exciting world of PLG SAAS, work with trillions of clickstream events, 10s of millions of users and a few unassuming terabytes of data. We are hiring, join our mission.



A deeper dive into how our engineers and data scientists build for the next evolution of SaaS go-to-market motions: Product-Led Growth.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store