Stop rolling the dice
If there was any one rule that was the most important in software development, I’m pretty sure it is ‘Have some form of version control, you idiot!’, and I have been breaking that for a while. I didn’t mean for it to happen, one thing just lead to another, you know?
Over the lifetime of Neo Chess, I’ve come up with a bunch of excuses not to bother putting in a version control system.
- There’s no point implementing version control when the project has only just started
- There’s not really any need since I am the only person working on it
- It’s easier just to take a backup of the game evry so often than bother with setting up a full system
- I’m a bad ass gangsta living on the edge and I don’t need your damn version control rules
I couldn’t have been more wrong on all of those points (except maybe the last one).
I just got a new hard drive for my computer, and was upgrading to windows 7, so I figured since I was formatting and would have a hard drive spare to hold my backups, I would bite the bullet and finally get something put in place. I have used perforce and subversion in my previous work roles, but I remembered reading a post by Joel Spolsky about a version control system I’d never heard of before, Mercurial. I like to learn new things, and I figured maybe this Mercurial thing might be the next best thing.
I downloaded and installed it (which was incredibly easy) and then cloned a repository. I spend a fair bit of time fighting wit the system trying to set things up the way I always had, by having a base folder in the repository, and having different projects under that, when what your supposed to do with Mercurial is have a repository for each project. After I finally figured that out, I thought I was all sweet. I did some work on my game and went to commit it back to the repository, but I got confused as to how I was supposed to do this, and where everything would be stored. Eventually after reading about it on the nets for a about an hour, I uninstalled it and installed my nice safe Subversion. This isn’t a reflection on Mercurial in any way, I’m sure it’s a fine version control system, I just figured in the end I was wasting too much time messing around with my tools, and not enough time getting things done.
So now that I have my version control system installed and set up correctly, I don’t know what the hell I was thinking putting it off for so long. The are heaps of benefits to version control
- Obviously backups: Once you are done making a change to some code, you back submit it, and it’s now backed up (although don’t forget to also back up your repository, I’ve seen a hard drive with everything in the repository on it go down with no backups, and it wasn’t pretty )
- Reasoning: If I’m looking through a file, and I see something strange and I think to myself ‘Why the hell did I do that?’, you simply look through the logs, find the change you made and look at the notes that you wrote as to why you made it
- History: It gives me the ability to think, what did my game look like on Tuesday August 4th 2009, and I could easily check out the files from that date, and see exactly where my game was at.
- Double Checking: Before I ever commit anything to a repository, I always go through every file and diff it against the original. The benefit of this is, you can catch code that you thought you were going to use, but never did and remove it so that it never gets into your source. Also, I’ve caught a lot of stupid mistakes at this stage.
I’m sure there are more I can’t think of right now. But for me the biggest one is freedom. Before I had version control, I used to just copy and paste the whole project into a backup directory about once a week. Then if I am working on my game, and realise that I need to restructure one of the main classes it was risky. I would comment out large chunks of the code, and re-write bits, which then would mean I would need to re-write things in other classes and before long I would hit a point where, if it didn’t work or I was better off with the first structure, I was in trouble. Trying to get it back the way it was is hard, and very time consuming. Now, I can make a change knowing that if I stuff something up, it’s only a matter of 3 mouse clicks to revert back to the origionals.
I love you source control.