From ‘if’ to automatic A/B testing

In 4 easy phases

  • When Facebook launched the most extensive messaging service to the whole world at once,
  • when Steve Jobs launched the new app store while he was on stage, and
  • when Obama’s campaign needed to choose a photo for their website.

Why?

Business releasing

Instant rollbacks

Fewer environments

Smaller batch sizes

Why build it ourselves?

Phase 1: Feature-ifs

void foo() {
...
[old code]
...
}
void foo() {
...
if (false) {
[old code]
} else {
[old code]
}
...
}
class FeatureToggles {
boolean featureName() { return false; }
}
void foo() {
...
if (FeatureToggles.featureName()) {
[old code]
} else {
[old code]
}
...
}
class FeatureToggles {
boolean featureName() { return false; }
}
void foo() {
...
if (FeatureToggles.featureName()) {
[new code]
} else {
[old code]
}
...
}
class FeatureToggles {
boolean featureName() { return true; }
}
void foo() {
...
if (FeatureToggles.featureName()) {
[new code]
} else {
[old code]
}
...
}
void foo() {
...
[new code]
...
}

Phase 2: Environment variables

class FeatureToggles {
boolean featureName() { return ENV["featureName"]; }
}
void foo() {
...
if (FeatureToggles.featureName()) {
[new code]
} else {
[old code]
}
...
}

Phase 3: UI

Phase 4: Automatic

Why not?

Double maintenance

Complexity

Testing is harder

Conclusion

--

--

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
Christian Clausen

I live by my mentor’s words: “The key to being consistently brilliant is: hard work, every day.”