The dangers of feature flags

Feature flags can be powerful. But they aren't free.

Feature flags can be powerful. But they aren’t free.

There are two main costs or dangers that I see with the use of feature flags.

The first is that they can make your code a lot more complex. Especially if you have multiple flags (or A/B tests) touching the same area of code. You can end up with a combinatorial explosion of execution paths, which can make writing tests and the code a nightmare. This problem is made worse (often much worse) by the second problem…

Cleaning up old feature flags often gets overlooked. At Booking.com, where there were hundreds or more tests running simultaneously, and thousands more no longer running, it was common to come across logic branches tied to feature flags that had been deleted for months or years. Or where the status of the feature flag was unknown. Had the author abandoned the feature, and forgot to clean it up? Were they still testing it? Would they be getting back to it later?

So if you use feature flags, please, for the love of code, clean them up when you’re done!

Your feature is not complete until the feature flag is removed!

Share this