Thursday, September 26, 2013

Supplement to the "Branch to Ship" Rant - What about Sandboxing?

Returning to thoughts on branching... Recently, we've been discussing sandboxes. Every developer using a modern source control system works for some period of time and gets their software to where it doesn't break the build before checking in. Following best practices, developers have to integrate all the most recent changes into their sandbox, run the tests, and make sure they run clean before they check in. That way the build is isolated from each developer's code before it is ready, but each developer is not isolated from everyone else's working code in the build. So in sandboxes, the isolation is one-way, and it doesn't interfere with continuous integration. Now, what if that period of sandboxing before checkin starts to get longer, and perhaps more than one developer is working on that code? Then you could create a sandbox branch that continuously integrates with the main development line, but keeps its own changes separate.

It's true in this situation that the rest of the team can't integrate with the sandboxed code, but there can be some overall benefits to the product of using these types of sandbox branches. You can take risks with prototypes, allow features that might not make the product deadline, or allow other types of instability and creative experimentation in the main code line without constantly breaking the committed product.

Another factor is there are big teams and then there are teams orders of magnitude bigger than that. If teams grow from thousands to tens of thousands, even if everyone is very careful, the statistics are just too high that someone will break the build every hour of every day. Isolation into independently-revving components is the main strategy here, but sandboxing of isolated features becomes more and more attractive on top of that to keep people from stepping on each other.

I will still rant about two-way isolation badness, but I think these one-way integration sandbox branches are worth adding to our bag of tricks.