First off, let me get this out of the way: If you write code of any sort at your day job and your employer doesn’t use source control then here are the only real options available to you:
- Convince your boss to employ source control for all projects.
- Find a real programming outfit to work for.
- Ninja it in at work anyway, on your own box if you have to, and count the days until you’re a hero.
We’re nearly done with the first decade of the 21st century for crying out loud and if there’s no one at your work smart enough to see the value in using source control then you’ve got major issues.
Okay, enough of that.
But what about our hobby projects? For years I never bothered with it. I’m always the only person who works with the code and I’m just having fun anyway. Having to set up some kind of source control service sounds too much like work.
It wasn’t until I spent an all-nighter searching for a stupid bug that I changed my mind. In the course of an hour I had transformed a work-in-progress to a broke-in-progress that simply exited to the desktop within seconds, with no information, even when run through a debugger. I wasn’t trying to add new functionality, it was just a bit of code cleanup here and there that had changed maybe 30 or 40 files (both in C++ and Lua). A good half of the changes were simply cosmetic in nature, for example, replacing tabs for spaces. I couldn’t believe such changes had somehow crippled my work.
So what the hell went wrong?
Or course the problem was I had idea what went wrong. Which files were changed significantly? Which files had innocuous whitespace changes? All I knew was somewhere around three dozen files had been changed recently, somehow. If only I had used source control I would have pinpointed the problem within the hour, instead of the five hours or so it took me through painful caveman debugging*.
I never want to work in the raw like that again, no matter the perceived complexity of what I’m coding, so I now use source control for every single thing I do, at work or home or whatever.
The benefits of source control seem more obvious when working with a group, when you need to see what some other idiot changed last week or last year, but you just have face the fact that, sometimes, you can be a moron too. Actually, that seems to be an emerging quality to my emphasis on best practices and my growth as a developer – to make up for the reality that I can really screw things up.
So I need that nifty project time machine, as The Pragmatic Programmer calls it**, that gives me the power to return my work to a less stupider time. Plus I never have to worry about pet projects long gone to some obscure folder on some old PC. It’s amazing how often I look up an old hobby project to help me get started on a problem I’m having today. I couldn’t work without it.
This doesn’t cost me anything.
I’ve never spent a dime keeping my code under revision control. I’ve used CVS, Subversion, and even Perforce (free for two users) locally and they’re all good options. About a year ago I went even one better and signed up for an online service that keeps my assets safe and allows me to easily reach them from any PC with internet access.
There are many options for this service out there but here are some mentioned by the programmer dudes on Stack Overflow.
Again, these are all free, with paid options (starting around $5/month) available for crazy people that want to put something huge, like Boost maybe, under their source tree.
BTW, don’t be a knob: This probably doesn’t need saying, but do not put your employer’s (past or present) code or assets under one of these services. This is just for you.
And nail a job interview question too!
Like most game developers, I’m thrust into a situation where I need to find my next job every couple of years. Oh god, those job interviews can be death, can’t they?
I’d say about half the time I go in for an interview I’m asked about my side projects. It’s probably not a deal breaker at most places not to have something on the go during your personal time. But, if you can talk about what you’re working on, why it excites you, what you’ve learned in the process, and why you have that sucker under source control then chances are you just nailed a very important query into your love for software engineering. And I just love pwning questions like that in an interview.
Hell, as far as I’m concerned, that’s reason enough to use source control for the home-grown projects.
(*Incidentally, the problem was the Direct3D Device had changed the floating point precision that Lua relied on. This nasty bug was always there, but changing the order that my Lua scripts were
require’d had brought it to the forefront.)
(**I read The Pragmatic Programmer’s recommendation that I use source control even for personal projects a good year before I adopted it. Shame on me for having to learn the hard way!)