I had the chance to work the Sitecore booth at MSBuild in Seattle last week and took the opportunity to walk around and meet some of the other partners in the Hub. A lot of folks are doing cool things, but one that caught my eye was the work being done by the LaunchDarkly team.

Feature toggling without deployment? Yes please!

What is LaunchDarkly?

The LaunchDarkly product is a tool to manage all your feature flags you’ve placed in your product, making it easier to continuously deliver functionality and turn it on and off without redeploying.

By adding the LaunchDarkly feature flags into your application, you can then manage them through the LaunchDarkly dashboard and turn things on/off, set rules for who gets to see the features, and lots of other cool things.

My long-time readers might recall me writing about something similar that Etsy was doing to support their continuous deployment model. However, deployments were required in that scenario in order to enable/disable flags. With enough resources, you can build something like this, but it takes time, planning, and a whole lot of effort to keep on top of the technical debt. Feature flags aren’t fire and forget weapons… they need to be managed constantly. Once you have decided a feature should forever be live and no roll backs are going to be needed, you don’t need that flag anymore and it needs to be removed.

How does LaunchDarkly help?

Feature management, dashboards, Visual Studio integrations… it’s all nice, but I think the real power here is the auditing. The most dreadful part of feature flags is trying to locate them, figure out if they are still being used, figure out if somebody changed something, and plan for removal. No more digging through code and source control history, everything about the log is available and searchable. This allows you to make decisions on your technical debt for feature flag cleanup.

auditlog

What does a feature flag look like?

The integration is actually very simple. Since everything is stored off in the server, your code is essentially calling out to the service and asking “Is it on yet?”


LdClient ldClient = new LdClient("YOUR_SDK_KEY");
User user = User.WithKey(username);
bool showFeature = ldClient.BoolVariation("your.feature.key", user, false);
if (showFeature) {
// application code to show the feature
}
else {
// the code to run if the feature is off
}

You may want to move the LaunchDarkly client initialization to a separate layer so that you can centrally manage the code that initializes the client and user object. This also would allow you to hide that layer in your architecture in case you decide to switch around the results that come back (for example, in a unit test).

Sounds cool, how do I try it out?

The free trial is available by registering on their site: https://launchdarkly.com/start/index.html

Also, the docs are a good place to get started: http://docs.launchdarkly.com/docs

Enjoy!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s