Feature Toggles

How many times have you as a software engineer worked on a large feature, in an isolated branch that only got merged to the mainline branch when it is time to actually release the feature and then struggled for hours and sometimes days with the merge conflicts, simply because many other changes were contributed to the main branch in the meanwhile?

If your answer is many times, then you really might benefit from this.

A feature toggle is a mechanism to make feature releases or enabling or disabling a feature based on user status or role, or just based on when the feature is fully ready to be consumed by clients. This concept is so simple and can save you hours of merge hell, and embarrassment if done right.

As I mentioned earlier, there are broadly two types of feature toggles:

  • Business feature toggle - something that is tied into the business logic of the application. Like a certain tier of users get a certain set of features. Probably the most common type these days. The Premium features require an additional cost and then you get additional features. * Release feature toggle - something you use to manage releases of new features to users.

The concept is really simple. At the heart of it is a binary state logic that determines if something is on or off based on a criteria. The criteria could be a direct value, a date or date and time combination, a version or whatever is appropriate for your scenario.

Combining the feature toggle concept with the concept of trunk based development, you'll have continuous integration implemented in no time with very little pain.

Don't trust me? Try reading the following:

comments powered by Disqus