Ruby to replace Java - or compliment it?

I've been singing Ruby's praises ever since I started researching the language a couple of years ago. I've not written much Ruby code, picked up the 1st pickaxe book, read it a couple of times, then the next year came round so I've now got the 2nd edition!

I've written a few Ruby 'scripts' (no objects or classes) and have been impressed with how quickly I have been able to get it to do my bidding compared to Java. One application running on Linux needed to read some data from a Postgresql database, generate a Windows Zip file then FTP it to a remote server. When I thought about coding this in Java I started to shiver, Java's strong point has never been it's ease to interact with the command line, and FTP libraries are not part of the java. or javax. packages.

Several people have asked "so are you saying that Java is rubbish and we should all move to Ruby?". My basic answer is "no, but I want to really get into a scripting language and Ruby seems OO enough for me to get into it fairly easily".

Dave Thomas (one of the Pragmatic Programmers) said it best recently when he said "not exclusively: you're likely to want to use Rails as well as Java." Dave has started a number of posts around this topic the first is titled "Is Ruby Better Than ...?".

Java and Ruby are similar in some respects and different in others, if I need to write some quick utility scripts or manipulate some text files then Ruby would be my choice. If I need to access some middleware message queues and fit into an existing application server infrastructure then Java would be the language of choice.

At the end of the day, it's all down to adding strings to your bow, sometimes the choice is just which strings to invest your time and effort in...

Technorati Tags: , , , ,

1 comment:

deer_stop said...

thanks for the article, I agree with Ruby being a real contender. I suggest a spelling correction to the word complement:

to compliment = 1. to pay a compliment to
2 : to present with a token of esteem

to complEment = to be complementary to (the illustrations complement the text)

source: merriam-webster