Source code control and precluding errors
If Martin Fowler feels this is worth an article, then perhaps the subject needs elaboration.
I long-ago adopted the habit of reviewing my changes before a checkin.
First, any code into which I have put a significant amount of work goes into CVS.
Once I reach the point where I am making changes to nominally stable
software, before I checkin my changes I always review my changes by
running:
cvs diff | less
Why? The usual problem is a bit of debugging code left in I had
intended to remove. Less often I find an unintended change or deletion.
In any case reviewing the diff takes little time, does catch
errors - and in the case described in the article, would most likely
have caught the error early.
Must admit that I am a bit bemused by the need to checkout two complete
source trees to compare two versions. When I have a similar need the
following command does the trick:
cvs diff -rtag1 -rtag2
Surely the esteemed Martin Fowler cannot be using something less
capable?
Oh - about tags - anytime I generate a build to give someone (anyone) else, I run a script that bumps the compiled-in build number, and tags the source in CVS with that same build number. This guarantees I always can pull out the exact sources for an executable.
None of this is by any means unique, or in any way my invention…