I recently did a talk about practices we have introduced to make us more agile.
At the end of the presentation, I mentioned distributed revision control as one of the next practices we want to do. Now how on earth does using Git or Mercurial increase our agility?
The short answer is: Feature Branches.
The long answer is...
We have a defined agile as among other things, this value: Ship working software.
This value implies that we keep the mainline of the code (known to many as the stable branch) in a working state. A good way to keep it that way is by making sure that only safe changes make it into the mainline. If you've got developers continuously working on the mainline to create new features piece by piece, chances are the code is in a broken state every now and then.
In order to remedy this, lots of companies (including ours) have decided that the team should maintain two versions:
This is a bit of an expensive practice, because you end up with long rounds of verification before the experimental branch can be released, replacing the stable version. You also have to continuously merge back bugfixes from the stable branch to the experimental branch.
So, the idea of feature branches is to keep new development out of the way until it is ready to go out in the mainline. When the feature is complete, you test it well. You then merge the feature into the mainline, do some quick verification that it is still in a working state, and then you release. Much smoother (agile) than releasing an entire experimental branch.
So feature branches are agile. Why don't we do more of those?
The problem is Subversion, or whatever other centralized VCS you're stuck with. They do not allow easy/cheap merging between branches (and I don't want to hear about that half-assed merge-tracking svn-properties hack), and therefore feature branches are practically impossible.
.
You might argue that Subversion users can keeping their changes locally in the workspace, but there's a major constraint: They can't collaborate on their feature. This means missing out on a lot of co-operation, creative process, ideas, code-review and refactoring before the feature ends up in the mainline. They could operate with sending patches around, but at some point it's time to ask how much hassle you have to take before you replace your malfunctioning VCS with a proper one.
At this point, I would like to outsource the illustration of how you can do feature branches in practice to the very fine illustration from Vincent Driessen. He has really nailed it, I think. In his model, what I've called mainline, or stable, he calls "master", and what I've called experimental, he calls "develop". The release branches also serve as nice points for setting up Continuous Integration (cause you probably don't want to set up CI for every single feature-branch).
So, summary:
Distributed Revision Control allows you to do feature branches, keep the software in a working state, and ship one feature at a time. In other words, more agile.
At the end of the presentation, I mentioned distributed revision control as one of the next practices we want to do. Now how on earth does using Git or Mercurial increase our agility?
The short answer is: Feature Branches.
The long answer is...
We have a defined agile as among other things, this value: Ship working software.
This value implies that we keep the mainline of the code (known to many as the stable branch) in a working state. A good way to keep it that way is by making sure that only safe changes make it into the mainline. If you've got developers continuously working on the mainline to create new features piece by piece, chances are the code is in a broken state every now and then.
In order to remedy this, lots of companies (including ours) have decided that the team should maintain two versions:
- one experimental, where new features are developed, and
- one stable, which should always be in a working state.
This is a bit of an expensive practice, because you end up with long rounds of verification before the experimental branch can be released, replacing the stable version. You also have to continuously merge back bugfixes from the stable branch to the experimental branch.
So, the idea of feature branches is to keep new development out of the way until it is ready to go out in the mainline. When the feature is complete, you test it well. You then merge the feature into the mainline, do some quick verification that it is still in a working state, and then you release. Much smoother (agile) than releasing an entire experimental branch.
So feature branches are agile. Why don't we do more of those?
The problem is Subversion, or whatever other centralized VCS you're stuck with. They do not allow easy/cheap merging between branches (and I don't want to hear about that half-assed merge-tracking svn-properties hack), and therefore feature branches are practically impossible.
.
You might argue that Subversion users can keeping their changes locally in the workspace, but there's a major constraint: They can't collaborate on their feature. This means missing out on a lot of co-operation, creative process, ideas, code-review and refactoring before the feature ends up in the mainline. They could operate with sending patches around, but at some point it's time to ask how much hassle you have to take before you replace your malfunctioning VCS with a proper one.
At this point, I would like to outsource the illustration of how you can do feature branches in practice to the very fine illustration from Vincent Driessen. He has really nailed it, I think. In his model, what I've called mainline, or stable, he calls "master", and what I've called experimental, he calls "develop". The release branches also serve as nice points for setting up Continuous Integration (cause you probably don't want to set up CI for every single feature-branch).
So, summary:
Distributed Revision Control allows you to do feature branches, keep the software in a working state, and ship one feature at a time. In other words, more agile.
I thought about this a lot lately and I agree with you: Feature branches are the way to go and they are a PITA in Subversion. Because of that, we do them only for large changes, and it always costs a couple of man hours to set them up and merge them.
ReplyDeleteI assume you're still into Git+SVN, do you use feature branches? Does that work well?
Thanks for your comment, Felix.
ReplyDeleteWe're still on Git+SVN, and I'm afraid that in being compatible with SVN, you are constrained to do branching just like Subversion does it, so there is very little branching possible. You always have to rebase and linearize before the Git commits go back into Subversion, oblivious that they were ever made in a branch.
That being said, if some of my colleagues are willing to work with me over Git, we can keep our work in a Git branch, before it's finally time to rebase back. I haven't actually done this yet, but I'm pretty certain it will be fine.
Sounds good. Our feature branches are usually used by only one person, so that work flow would be fine.
ReplyDeleteI'm not the first person to conclude this, of course. Jeffrey Palermo did so all the way back in January.
ReplyDeleteAlso here, especially David Arve's paper on the subject.
ReplyDeleteDigging further through history, I've also found
ReplyDeleteReinH's Git Workflow for Agile Teams which again is based on Josh Susser's Agile git and the story branch pattern.