Kurser i Domain-Driven Design - VĂ¥ren 2012




Tuesday, May 31, 2005

It's Subversion time!

One of the most important tools in the developer’s toolbox has got to be the version control system, the VCS. This is where we store everything created during hard work on our development project’s journey from the first line of code to release and continued maintenance. The VCS forgives us if we accidentally delete the wrong file and lends a helping hand when it is time to fix that pesky bug that popped up out of nowhere in the deployed software. The VCS is one of the system developer’s closest buddies. If the system works, that is, otherwise it can be a pretty darn annoying enemy.

Surprisingly often when working at a client site I encounter a product that I guess most of you are familiar with, Visual SourceSafe – VSS. SourceSafe Pretty Much Does Not Perform as a version control tool. I really cannot understand why Microsoft put their name on it. There are probably about a billion blog lines of text written on the topic of SourceSafe’s failure to perform, so I will not bore you by adding more to that. But, if I got a Swedish Krona (or SEK for those of you who know your ISO 4217 currency codes) for each time I tracked down problems in source code related to the behavior that if a file is deleted from the repository by another developer SourceSafe fails to remove that file locally when a Get latest… operation is performed, I’d be rich. Or at least I’d have enough money for half a latte at CoffeCup in Stockholm’s main train station. But if you don’t like lattes, or just feel like you need more arguments against SourceSafe, try http://www.google.com/search?q=sourcesafe -site:microsoft.com (or, for the sake of irony, the new MSN Search: http://search.msn.com/results.aspx?q=sourcesafe –site:microsoft.com).

I can only speculate in why SourceSafe shows up time and time again; I guess availability could be a major reason since it comes bundled with development tools from Microsoft, also it is fairly easy to get started doing version control using SourceSafe if you’re running Windows. Rumors also say that there is a fair chance of successfully integrating SourceSafe with VisualStudio.

In the open source arena there is another ruler: CVS. Among open source developers CVS has been the favorite for a long time and the de facto standard for version control. I have used CVS from time to time and I think it is pretty good, but I certainly do understand that there might be people who find it a bit scary with its command line oriented heritage and semi perfect Windows support, although modern IDEs such as Eclipse and JetBrains’ IntelliJ IDEA have done their share to ease usage. CVS is far, far from SourceSafe’s dire state but still, it has been around for quite some time, and signs of aging are beginning to show. CVS has its share of less great solutions that could need an overhaul.

This is where Subversion comes in! Subversion is a new version control system, created from scratch, and available as opens source. The Subversion development project has been going on for some time, with the goal of building a compelling replacement for CVS in the open source community. Terminology and the ways of working have been kept from CVS to facilitate migration to Subversion, but at the same time many of the problems in CVS have been fixed. On the list of new sweet functions we’ll find atomic commits, complete version control of directories, support for moving and renaming files and directories, effective delta support for binary files, and more.

At the time this is written Subversion is available in version 1.2.0. I have only been running it with Windows, but binary packages are available for Solaris, Red Hat Linux, MacOS X, and more platforms. Subversion can be installed locally for version controlling files stored on the local hard drive or, perhaps more interesting, as a server allowing multiple participants in a project share files. Several options for server installation are available, one is to run Subversion with Apache HTTPD 2.0 and use HTTP/WebDAV as transport.

The selection of Subversion clients is considerable, with different feature sets, maturity and quality. One of the most mature clients available for Windows users is TortoiseSVN, a shell extension to Windows Explorer integrating Subversion in the Explorer file browser (if you’ve been using TortoiseCVS you know how this works). Several other clients are under development, one example is JetBrains that will deliver integrated Subversion support in next major release of IntelliJ IDEA. Scripts for converting existing CVS and SourceSafe repositories are available for download. The conversion process usually makes it possible to keep version history and user information from the original repository. Continuous integration tools such as CruiseControl already offer Subversion support. An Ant task is being developed, and the Ant exec task can also be used if you feel like automating your build process (which you of course do).

Subversion manages files using the copy-modify-merge paradigm, a CVS user should have no problem start using Subversion. If you’ve used SourceSafe with the multiple checkout option set, you’re in pretty good shape as well. If you on the other hand has used SourceSafe with its default behavior that employs exclusive file locking you may have a little initial challenge converting to the Subversion way of thinking and working. I started my version control journey on SourceSafe myself and initially had a very hard time comprehending how copy-modify-merge could ever work without creating total chaos. But it turns out it works very well as long as you work with files that can be merged (e.g. text files), and after a while it’s really hard imagine going back to the “old” way of doing things.

It has never been simpler and cheaper to get a powerful and modern version control system. Take good care of your code, stop using SourceSafe and have a closer look at Subversion. Yes, now.

Closing comments

This text was initially written in Swedish by me and edited by Tobias Fors for Citerus’ excellent newsletter on effective software development, PNEHM! When the article was pre-released internally at Citerus it sparked a bit of a discussion, a colleague of mine strongly claimed that it was wrong to argue that people should throw out their existing working VCS system in favor of a half done product such as Subversion. I don’t have a hard time agreeing with that statement as such, but I do believe that SourceSafe isn’t a working VCS system, and although Subversion may not have been around as long as CVS I definitely believe that it is good enough and it will continue to improve. The Subversion project has been self hosting for several years and in 1.0 release for over a year. I’d say that Subversion is starting to reach the early majority (but then again, who am I, Gartner?).

As for switching from CVS to Subversion I’m not so sure if it is time just yet, it depends on your situation. PushOK argues that Subversion is not ready to take CVS’ place, Holub on the other hand argues the opposit. As always, it is up to you to investigate the options more closely and make your choice. As long as you don’t let that choice be SourceSafe.

PNEHM! is published mostly with Swedish content and is available at http://pnehm.citerus.se/ Read it online and sign up to be notified when new articles are available.

/Patrik

Once more, with feeling

I was home, sick, the other day (yeah, happens to the best), and finally had the opportunity to watch the excellent U2 Elevation Tour DVD, filmed in Boston 2001.

Being an engineer I always carry around that somewhat silly urge of trying to figure out how things work; from that perspective the extra material on the DVD with all the "The making of" stuff is a mandatory view. In one clip of "the making of elevation live" you can see director Hamish Hamilton jumping up and down in the broadcast bus (or whatever it would be called in TV production speak) during the very start of the live take, screaming "I love my job! Come on! Come on!!!".

And, once again, it hit me, I mean, I love my work too, but, funny thing, so far it has really never managed to provoke that kind of reaction. No jumping. No screaming. Yeah, sure, now and then you stumble across a piece of code that is particularly great performing, elegant, self explanatory and simple. Yes, subtle excitement has been known to occur on occasion. But it is pretty far from the feeling you get when you see Bono entering a sold out arena.

Perhaps we can find a way of putting more feeling in there. Or perhaps in my next life I'll do something else, drummer perhaps. Yeah. Cool. But for now, time for some more CRUD.

But then again, to quote the singer himself: A singer is someone with a hole in his heart almost as big as the size of his ego. When you need 20,000 people screaming your name in order to feel good about your day, you know you're a singer. Bono: 2001 Harvard Commencement Address

/Patrik