Skip to main content

Why Subversion is better than CVS for Java developers

Over on the JDeveloper forum, John Stegeman responds to a question about whether CVS or Subversion is better for Java development:

... "Subversion," especially if you are using ADF business components. My reason for saying this is that we initially tried CVS [in an environment where] the network was not the most reliable. We had some problems where the network would drop in the middle of the commit (not a JDev/CVS problem), and half of the changes would be committed to the repository, and half of them were not. In the case of the Business Components, having the XML files and Java source files out of synch was a major major problem. This particular problem is one that Subversion solves; with Subversion, either the whole commit happens or none of it happens, just like a good database.

He makes a very good point. Atomic commits are one serious advantage Subversion has over CVS. In Java applications, where you tend to have a lot of files (as opposed to C where a lot of logic is concentrated into a smaller number of source files), it's vitally important that all of your changes are submitted along with each other.

Another big advantage of Subversion compared to CVS is directory versioning. In Subversion, directories have versions, just like files. The history of a directory is tracked over time. In the Java world, we like to move stuff around a lot (let's refer to it as "refactoring", although that word has additional implications). It's nice to use a version control system that does a good job of handling complex move operations over time without resetting element history.

Comments

  1. Pretty much the only reason to use CVS these days is because you registered a project on sourceforge before they supported Subversion, and even then, you can migrate.

    I was a great fan of CVS in its day (WinCSV rules!), but it is 2007, and atomicity has to be a given....

    ReplyDelete
  2. One more reason why I like svn is that, it is not the individual files that are versioned. It is the whole project that is versioned.

    This way you don't need to know a particular version of a particular file, rather you need to know, a file in the particular version of the entire project. This simplifies things a lot.

    ReplyDelete
  3. I love that you can use https to access SVN, which makes it much easier to use through firewalls. On the other hand, commits and updates are much, much slower.

    ReplyDelete
  4. A reason *not* to use SVN is that you can't get up-to-date binaries for the Mac. And you can't compile it because you can't check out the code from SVN.

    When SVN is supported on the Mac (and by supported, I mean a binary that I can download and install), I'll switch to using it. However, at the moment, it's Linux/Windows only.

    ReplyDelete
  5. As alblue subsequently noted on his blog, you can now get an "official unofficial" Mac OS X build directly from CollabNet.

    Prior to this, I'd been getting Subversion from one of the guys at Coding Monkeys (the SubEthaEdit people); he's done a good job of staying up to date, with 1.4.3 currently available.

    ReplyDelete
  6. Agreed with the of benefits that you listed like atomicity and folder versioning..etc.

    But one thing is still missing in SVN, history across the branches in a single view. It is supported in CVS.

    That's the only reason of my dislike of SVN.

    ReplyDelete

Post a Comment

Popular posts from this blog

Java Blooper #2: Must be a Better Way...

The post you're reading is ancient, and yet slightly inexplicably popular :) I've recently started blogging again in 2020 with some fresh content. Check out some of the new topics about blogging again, dynamic method invocation, and aapt2.It's Monday, which means it's time for another blooper... What's wrong with this code? boolean hasThing( List things, Thing thing ) { for ( int i=0; i < things.size(); i++ ) { if ( thing.equals( things.get( i ) ) ) { return true; } } return false; } Update: Minor edit to add missing parenthesis from if statement that got "lost in translation" en-route to the blog :)

Configuring Mac OS X Terminal

The post you're reading is ancient, and yet slightly inexplicably popular :) I've recently started blogging again in 2020 with some fresh content. Check out some of the new topics about blogging again, dynamic method invocation, and aapt2.I recently installed Leopard (Mac OSX 10.5) on a new mac. There are a few factory settings I usually change on a new installation, although by far fewer than I do typically with Windows. One of them is the default keyboard configuration for Ctrl+Left Arrow, Ctrl+Right Arrow, Page Up, Page Down, Home, and End in Terminal. The default settings drive me a bit potty since I'm used to using Linux and emacs every day at work.Changing them is easy, fortunately. Just visit Keyboard under Settings in Terminal->Preferences, and modify the following keys, so that their action matches the value shown. You can edit the keystroke for an item by double clicking on it, selecting "send string to shell", and typing the indicated keys.KeyActio…

Java Blooper #1: Ternary Insanity

The post you're reading is ancient, and yet slightly inexplicably popular :) I've recently started blogging again in 2020 with some fresh content. Check out some of the new topics about blogging again, dynamic method invocation, and aapt2.From time to time, we all write code that could be clearer. Sometimes in the rush of solving a problem, we don't pay attention to the micro details of the code flowing from our fingertips. Other times, we refactor some existing code, and don't necessarily take the opportunity to clean up as much as we could.I find it useful sometimes when reading code to think about whether it could be rewritten in a more straightforward way, and if so whether any lessons can be learned about writing tight and expressive, and most importantly, readable code.Over the next few weeks, I'm going to blog weekly examples of some Java code bloopers that I've seen. All the examples are real and have been observed "in the wild". However some…