Quantcast
Channel: Assembla Blog
Viewing all articles
Browse latest Browse all 123

Now you see it, now you don’t: The importance of feature switches

$
0
0


One of the essential techniques for continuous delivery, or any reliable release process, is the inclusion of switches in code to turn features on or off.  You typically do by putting an IF statement in your code like this:

IF <configuration variable or user attribute>
               New stuff
ELSE
               Old  stuff

This technique has at least three important applications:

1) Turn features off if you find a problem in late stage testing.  This is a lot more civilized than sending code back for an emergency fix, and it’s a tactic you will need for any reliable release schedule.

2) Turn on features so that only developers or internal accounts can see them.  I call this “dogfoooding.”

3) Release large features incrementally.  As you build a large feature or architecture change, you put it into the release build, but leave all of the visible parts turned off.  The code and data structures propagate into your system and release process.  By the time you decide to turn on the visible parts of the feature, it’s clear that everything works.  This is a very important use of code switches.  It might not even be possible to release big changes in hosted systems without this technique.

After you switch, remember to go back and remove your old code.


Viewing all articles
Browse latest Browse all 123

Trending Articles