Thursday, August 30, 2007

Why Subversion is better than CVS

Last week I was talking with a workmate about Subversion (I will use
SVN as a synonym) and CVS. He enlightened me on the advantages of the
former.

The strongest argument I find in favor of Subversion is the concept of
revisions. In fact, some time ago, while working on a project that
uses CVS, I came accross the need to determine which files I had just
committed. Turns out that, in CVS, there is no easy way to do that:
files are versioned separately. Conversely, in SVN, a global revision
number is incremented with each commit. In this way, it is possible to
know which files were commited together, by querying the SVN system
about what happened in a specific revision.

Moreover, should the need to revert the state to some point in the
past arise, this would translate in SVN to just replacing the files
with an old revision, and all files would be consistent and work with
the others appropriately With CVS, there would have to exist a
previously made tag if a set of files must be in accordance,which is
usually the case.

From what I explained above, it can be concluded that many of the
cases in which tags are needed if CVS is used, are eliminated by the
use of SVN, thus simplifying administration. SVN is also quicker at
branching and tagging than its predecessor.

There's another issue: that of renaming files. In SVN, as opposed to
CVS, there is true file renaming, which preserves the whole history of
the file. In CVS, the normal way of renaming consists of a delete plus
an add.

Migrating from CVS to SVN can be done in a very short time, and a true
SVN repository results from the process. The migration implies looking
at the user and time of commits to group files together as tough they
were actually committed using Subversion.

Tuesday, August 21, 2007

Maven download dependencies 'pseudo-goal'

Today I wanted to check that I had all the dependencies I needed for a
new project I imported into my workspace. As I had not made some
necessary modifications needed for compiling, and I didn't want to
make changes to the code, install anything onto the local repository,
or anyhow change anything at all, I started looking for a plugin-goal
combination that would satisfy my very specific needs, i.e, to just
download the dependencies.

To my surprise, I did not find it. But in my search, I run into this
thread in a forum:
http://mail-archives.apache.org/mod_mbox/maven-users/200605.mbox/%3C001c01c67450$b2c24680$1706a8c0@LXP0001%3E

Based on what people suggested in that thread, I just copied the
project.properties, project.xml and maven.xml - I am currently using
Maven 1.0.2 for this project - to an empty directory, and typed
'maven' from a command prompt. This did the trick indeed. Thinking it
over, it is quite logical, since there's nothing to compile but the
dependencies are specified anyway.

One additional note: in my configuration, the default goal for maven
is java:compile, as specified in the maven.xml file.

Friday, August 10, 2007

Eclipse Tip: Show method body from calling method

If you have a method call somewhere in the code, you will notice that
placing the mouse pointer over the method call displays basic
information about that method. That information includes the method
signature, and method and parameters description.

But there is also a useful and not always known shortcut (at least I
had missed on this one).
If instead of just moving the pointer over the method call, you press
the Ctrl key and then place the mouse pointer as stated before, the
whole body of the method being called will be displayed. Moreover,
releasing the Ctrl key and pressing F2 instead will open the usual
focus window allowing for easier reading.