Many developers (especially lone developers) don't understand the advantages of using source code control / SCC (a.k.a. source code management / SCM ). SCC means registering your source code with a repository so that revisions and versions can be logged and stored. Most often, SCC is used with team-based projects since the repository can allow multiple people to work on the same project at the same time. Changes are uploaded to the repository and coordinated so that one person's modifications do not overwrite another's.
Advantages of SCC
The some of the most compelling advantages of using SCC include:
- Frequent backup of source code -- Since developers are expected to update the source files on the repository regularly, that means there will be a backup in case the individual developer's machine crashes.
- Coordination among many developers -- Multiple people can work on the same project without worry that their changes will overwrite the work of others.
- Differencing with past source files -- Most SCC systems allow the examination of a current version of a source file with a past version to view changes.
- Archival of shipped versions -- SCC allows you to mark or tag the current stages of a set of files. That means when you ship version 1.0, you can tag that version. When work continues, if you ever need to restore the files to their 1.0 condition (perhaps to duplicate a customer bug report), the system allows that archived version to be restored.
Scenarios Where SCC Saves the Day
As an individual developer, these advantages might not seem especially compelling, but imagine some of these scenarios when you are in active development of a program (such as a Joomla! component):
- You started a rewrite of a central program routine and it stops working -- You've spent several days rewriting or refactoring a routine that's key to the function of the application and you have a deliverable tomorrow. Suddenly it stops working and you can't figure out why. With SCC, you can either examine or restore a previous working version of the routine.
- You want to begin a substantial rewrite of a routine and you're commenting vast runs of older code making the source difficult to read -- With SCC, you can just delete the old code! As long as you committed the last version, you can examine the old code stored in the repository with only a few clicks.
- Your project gets corrupted and you realize your last backup is a week old -- With SCC, committing your changes to a repository can be done by simply right clicking on the project folder and selecting the commit option. This makes it much more likely you'll keep your backups up-to-date.
- A co-worker claims that he created a great deal of the code in the new version of the software -- SCC allows you to demonstrate historical progress of a project by individual user commits, so you can show not only the exact work that you've done, but also the amount and progress of the changes.
- The code has gone through so many changes that it looks like spaghetti and you want to refactor starting with the initial elegant version -- If you register your source files when you begin a new project, you can venture back to any point in the revision timeline.
Getting Started with SCC
SCC is available through a number of free, open-source programs. CVS (www.nongnu.org/cvs) is likely the most popular since it has been around with full-functionality the longest. Close behind is Subversion or SVN (subversion.tigris.org), which is the system used by the Joomla development team. If you're running on the Windows platform, both of these have excellent client implementations in the form of TortoiseCVS (sourceforge.net/projects/tortoisecvs) and TortoiseSVN (tortoisesvn.tigris.org).
Wikipedia has an excellent comparison chart of most of the popular SCC systems here:
http://en.wikipedia.org/wiki/Comparison_of_revision_control_software
Group-based or Solo Development
For group-based development, you can set up a CVS or SVN server that can accept commits for source file updates over the network. However, both systems also allow you to use the SCC without a server -- you simply create a repository on a local or network drive. I've found this deployment most useful when working solo on a project. Both TortoiseCVS and TortoiseSVN allow you to create a local repository without any additional software installation.
Using SVN for Joomla! Development
If you want to see how to use SVN for the development of Joomla templates or components, check out the article Using TortoiseSVN for Joomla! Extension Development.



Del.ici.ous


