Cool Computer Club

iff

(This post was originally posted on gist.github.com, with development now on github)

On implementing a client for feature flags in your UI codebase #

This document isn't an explainer on Feature Flags, you can find that with my amateur writeup, or literally hundreds of better writeups out there.

This document is also agnostic to the choice of service you'd use: LaunchDarkly or split.io or optimizely or whatever; that's orthogonal to this conversation.

Instead, this document is a list of considerations for implementing a client for using Feature Flags for User Interface development. Service providers usually give a simple fetch and use client and that's it; I contend that there's a lot more to care about. Let's dive in.

To encourage usage, we'd like for the developer experience to be as brutally simple as possible. So, this should be valid usage:

import iff from "iff";

// ...

const flagValue = iff("flag-name", defaultValue);

This basic experience already raises some implementation details:

Bundlers #

With the way we use this and the current state of bundlers (webpack, parcel, etc), you'll see that we ship the code for multiple branches inside a bundle. This isn't a very critical problem for us at (heavily client side rendered software firm); we don't optimise as much for Time To First Interaction. But, there are a couple of options we can take, each with it's own tradeoffs.

Analytics #

It's important to tie this closely with our analytics story, whatever that may be.

TODO: Flesh this out in more detail

Education for developers #

We can't just ship this feature and assume it'll be used perfectly immediately. This is a massive culture change for (our firm), and we'll have to guide everyone through this journey (which may last for months, if not years)

Education for SDLC #

The above is useful for the actual act of writing code, but there's also education to be developed in the broader context; how to use feature flags to ship softeare effectively.