Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then
Software and Technology by
Since I've been programming a bit lately, I've come to understand more and more the reason why version control systems (like Subversion or Git) are useful for single user projects. For a long time, I never understood its purpose or usage and thought it was quite wasteful to use version control for personal projects - code which nobody else would touch anyway. I now realize that it is an extremely useful tool in any programmer's arsenal for any coding project, big or small.
Without going into the advanced features or usage of source control systems or into debates over which is better - centralized or distributed VCS - I'll list down a few of my thoughts here on why every programmer should use version control for all but the most trivial projects.
Quick and easy history of changes
The most visible benefit you get out of source control management systems is that it creates transparent snapshots of your program code at various stages of development.
The history generated by your code commits can be very useful when you come back to a project after a long time and wondering what features you've put in and what else needs to be implemented. This especially if you write good commit messages and document your code with enlightening comments.
A more advanced backup mechanism
A VCS provides a foolproof way to retrieve a working version of your code when you've accidentally (or deliberately) done something destructive to the working copy. If you use a distributed versioning system like git, you can actually maintain a remote backup of your local repository.
Easier code publishing
Publishing your project to the world is much easier if you use a source control tool. There are plenty of free online services which provide repository services for such tools. Nearly every free software/open source project out there hosts its source code on an online repository.
If you don't use source control, you'd need to make a manual copy of your source code, label, archive and upload it to a website for others to download and use. And repeat the process every time you make any change.
Multiple paths of development
It's much easier to follow multiple paths of development using a VCS with common code base. In fact I would suggest that it is the only sane way of doing it. Having a separate code-base for a similar project by copy/pasting code is ugly and error-prone.
Sane and logical version numbering is possible
This is an often overlooked benefit of using a VCS, but I should have thought this was the most obvious benefit. If you don't use a VCS, how will you find out what code was present in version 1.0 and what code you changed when you modified it to version 2.0 (and threw away version 1.0 without archiving it somewhere)?
Without a source control system, it's all too easy to get carried away and make massive changes to an existing code base without realizing somewhere down the line that you need some kind of version numbering scheme for the different stages of the project.
Accepting contributions from others
Even if you start out as a single programmer, you might consider expanding the team as the scope of your project grows larger. And you can only do this properly with an online source control repository. Modern VCSes have become better at merging code making the process less painful than before.
Finally discipline in coding
Using a source control tool forces you to think of what changes you make to code by frequently committing such changes to the repository. You also tend to work in "sessions" on a particular problem without getting side-tracked. Before you start working on the next big feature, you realize that you need to commit your existing changes and describe them suitably and thus create a logical path of development unconsciously.
Posted on Thu, Dec 2, 2010 at 18:39 IST (last updated: Thu, Dec 2, 2010 @ 18:43 IST)