Wednesday, July 23, 2008

Version Control

If you develop code for a living you'll eventually become acquainted with version control systems. They have names like PVCS, CVS, and Surround SCM. Programming is all about code changes. Even if you're privileged enough to write a new system it will eventually undergo changes.

Version Control Systems allow developers to track changes to code from its inception all the way through to its current incarnation.

What's good about this? First, there will be times when a new version is put into production and it just doesn't work. You might be able to tweak your changes in production for a little while but soon you'll have to fall back to the old version so that business is not impacted. Often the VC system is the only, or easiest, way to fall back. Second, you may be working as part of a team and will have to coordinate your changes with others on the team. VCS provides a way to distribute your modifications to others and provides an exchange to merge their contributions with yours. Third, even the best intentioned user will eventually ask you to put the function back in that he asked you to rip out a few months ago. If the old version is in a VCS then it's easy to recover the piece that needs to be reconstituted.

What's bad about VCS? There's a learning curve to overcome. All this checking in and out, updating, etc. is not intuitive and one needs to invest some time learning how to use it. Second, it requires discipline to get your changes into the system on a regular basis. This is especially important when working in a group so that others can incorporate your changes sooner rather than later. Time is money in the program development world.

It's obvious to me that the advantages outweigh the disadvantages. Steve McConnell, author of Code Complete and Rapid Development lists "Lack of automated source-code control" as a classic mistake. Yet I've found many IT Managers who'll pay lip service to VCS but, somehow it ends up on the bottom of the priority list and can languish there for years.

If you're wed to the idea of versioning but the boss won't provide it then set it up yourself. In my home office I have a cast off laptop running Fedora Linux with a CVS server. The ssh port is exposed to the internet and many of my clients allow ssh through their firewall. I sit at my desk on my employer's premises and regularly update the repository at home.

No comments: