Topic: A little rant about source control

I just need to have a little rant here, feel free to ignore me.

Every project should use source control. I have read that every project with more than one contributor should have source control. I disagree. EVERY project should have source control. It is the most useful tool during software development. If something breaks, you can roll back and find out where it broke. If you forget what you've been working on, you just diff against a previous revision and you can clearly see all the changes you made. Without source control, it's impossible to keep on top of anything more than the most trivial project.

So, a project/company uses source control. It's all fine? No?


Not when you have a system that allows only large commits.

For example (and any similarity to real life is entirely coincidental... honest) Imagine the following situation. A major part of a game GUI. It was written for one resolution with some hardcoded magic numbers that noone remembers how they appeared. Then someone is told that it has to support 2 more resolutions. A little investigation into the magic numbers followed by giving up, pressing print screen and measuring the pixels in photoshop/gimp/paint/... to calculate the magic numbers for those screen resolutions.

Then imagine that, for whatever reason, the game has to support a minimum of 6 more resolutions, with the potential of many many more. So the GUI needs to be scalable, right? Enter stage someone who looks almost exactly like me, but couldn't possibly be me because this is an entirely contrived example. This person gets his head stuck into the project for a week, fixing bits here and there, generally doing a tidy up and making everything scale nicely until he gets left with just the accursed magic numbers. Up until this point most of the fixes have been small and easy to keep on top of. Fast forward 3 days. The magic numbers are eradicated. The programmer feels good about himself and sets about rebuilding the bits of the GUI that had been stripped out in the process. He gets about half done. Then he gets pulled away for a 2.5 hour long meeting. When he gets back, he looks at what he's done and for some reason the bit he's been working on is, for some unknown reason, 2x too large. Now, of course, making the numbers half as big could solve the problem, but it doesn't explain why they're suddenly so big. And diffing against a previous revision wouldn't work because it's 3 days old and relies on magic numbers.

In this entirely fictional example, the solution could have been to fix a little and submit it to the central repository. That doesn't always make sense because if it's a fairly major change, you can't submit small parts without compromising the stability of the central repository. What would be sensible in this case is to use a distributed source control system, such as git or mercurial. This would allow a local repository which you can commit to, diff against, branch, whatever you want. Then when the whole task is completed, it can be pushed to a central server.