(2010-10-29) Fowler Feature Toggle Instead Of Branch For Continuous Integration

Martin Fowler suggests the Feature Toggle instead of (Version Control System) Branching to support Continuous Integration. Good for A-B Test, etc. The basic idea is to have a configuration file that defines a bunch of toggles for various features you have pending. The running application then uses these toggles in order to decide whether or not to show the new feature... It's very important to retire the toggles once the pending features have bedded down in production. This involves removing the definitions on the configuration file and all the code that uses them. Otherwise you will get a pile of toggles that nobody can remember how to use... Feature toggles can be used for permanent variable configuration too, such as different versions of a software for different contexts. This is a different usage to handling pending features but most of the implementation is the same. If you use feature toggles for other scenarios too, it's wise to clearly separate the pending feature case from the permanent cases.

Can be tough to do when there's a schema change involved, thought, right?

While feature toggles are a valuable tool in the box, they are a second-best option. The best thing to do with such features is to find a way to gradually release them into production as you are building them. This gradual release get you a return on investment earlier as well as superior feedback. I would always look for a way to do that, and only use feature toggles when we can't find such an option. Most people don't try hard enough to gradually release new capabilities.

Jul'2011: James Golick wrote about the code his team uses to manage incremental deployment.


Edited:    |       |    Search Twitter for discussion