jueves, 13 de marzo de 2008

Always fix bugs in the trunk

I just realized this: Keep the number of environment branches to the bare minimum and always fix bugs in the trunk.

What is an environment branch?

It is a branch based on a release (a release branch) or based on a machine (an environment branch). Since every release was tested on an environment, every release branch is an environment branch. But environment branches are not needed, in my opinion. Here is why.

Some development shops keep a separate branch for each environment, not only for production builds, but also for UAT, QA, SIT, development and so forth.

First of all development should be done in the trunk.

Second, if the bug can't be reproed in the trunk, why care? One valid reason is that some customers need the fix.

Third, why have a UAT branch? Do you really think that you will fix a UAT environment and then continue testing? Would't be more reasonable to test everyting again if you are submitting a patch to UAT?

For having the idea of submitting a patch for UAT you should be ashamed, since the patch invalidates all the previous tests. Furthermore, why not wait for a development build to pass QA and then pass UAT?

And since we are testing so much, why not automate the testing (for example using JUnit)?
I've run into a project that keeps separate branches for every environment and when a bug is found in UAT or whatever environment, you are given a branch based on that branch. You fix it and request a merge against that branch.

The only problem is that there are mountains of integration problems when that fix must be merged against the trunk, because you are working on such an old branch (UAT), so that the merge becomes meaningless and totally buggy.

One excuse is that if you fix all bugs in the trunk, you will be using really new code, and therefore you will use code that doesn't exist in the UAT or production enviroment and therefore merge will be impossible. In that case I would prefer a back port (although it may take a while) or redoing the fix for the older enviroment.

Having so many environment branches and keeping track of them is a nightmare.

No hay comentarios: