Green Ruby Programmer

This space will chart my progress through the world of Ruby programming. Hopefully, it will conclude with me becoming a master Ruby programmer. With a moniker like this one, I shall have plenty of motivation to make that sooner rather than later! My other favorite programming languages these days are Python and Java. I have known both of them for about a decade.

Thursday, May 04, 2006

Javalon and Rubitilicus

Though I know a lot of computer languages, I do not really learn new ones on a whim anymore. There has to be a good reason to pick up a new one these days. Especially, if it is a relatively complicated one like Ruby - with very different syntactical idioms than others I have used.

A language like Java really is competing for the same jobs, contracts, programmers, and book market as Ruby. So, while the languages are not really all that similar to each other - they will be showing up at the same contests, and get to know each other really well.

Ruby and Java are like two very different organisms.

Both are roughly the same size. Both have claws, sharp teeth, webbed feet, 2 eyes that see things well close up and far away and spot movement easily. Both run on 4 legs, with webbed toes, and can swim if they have to.

They are both social creatures and usually hunt and live in packs. They communicate with each other, mark their trails, and also mark their territory.

One is a reptile. A cool, thoughtful, cautious, character.

The other is a mammal. It has a faster metabolism, and it burns more energy, especially when it seems to be at rest. It can cover more ground in less time than the other.

While they have some superficial differences and similarities, they also have one other thing in common. They both hunt the same prey. They live in the same ecological niche, despite their dissimilar ancestory and completely different taxonomy.

One way that computer languages have distinguished themselves from each other for the past decade goes beyond grammar things like syntax. What is almost as important on a day-to-day basis as that to a programmer is the standard library.

The Java standard library has a great GUI API - almost a framework, really. Swing GUI programs can run unchanged on lots of different platforms. They can adopt the native look and feel of the platform, use one of the built-in ones that comes with Java, or a company IT department or application programmer can define their own.

Yet J2SE does not come with any web APIs in its core library. You have to pick those up separately, with a web container like Tomcat, or a J2EE container like JBoss.

Then you get things like servlets, JSP (sort of like ASP), JSTL (a template language with a simple expression-evaluator and some standard tags), etc.
Or, you can write your own - the basics are not hard.

Still, web support is not included in every Java environment.

Ruby does not have a standard desktop GUI. Yet it does support web programming very well - right out of the box. It comes with CGI support, a templating tool (erb), and its own web server called WEBrick.

The core libraries of both languges come with XML support.

The support for XML in Ruby, through REXML, is more high level than that of Java (though lacking in validation support). Ruby also comes with support for the super-popular RSS standard. Java does not come with RSS support.

Java supports code reuse beyond standard OOP techniques using templates. Templates can be typesafe and are basically parameterized class types.

Java supports iteractors too, through another upgrade introduced in J5SE: the improved for statement.

Ruby supports code reuse beyond OOP through: mixins (via its include statement), and blocks. It also has a lot of direct support for functional programming and iterating through collections.

The technologies in both languages can cut down on source code bloat.

As is typical of most other things in these languages, Java makes it possible to write safer code with more pre-execution checking available. Ruby offers little such built-in safety. Yet a programmer has to write less code to get reuse - sometimes far less code.

Yes, unit tests will catch a lot of errors if you write them. However, nobody tries to get 100% coverage with their unit tests, let alone achieves that. Excellent unit testing frameworks are available for programs in both languages too, so as a point of comparison - unit tests are moot.

If you feel like doing far less typing, chances are, Ruby will fit your bill.

If you do not mind typing in a lot more code, as long as you get a lot of compiler-time checking, then Java is probably more to your ilking.

Another concern is Integrated Development environments. Clearly it matters as much, if not more so, than the contents of the standard library. After all, you can always look for things not in the core libraries in some third party libraries.

Java has Eclipse and NetBeans as its flagship IDEs. These IDEs are both widely accepted and on the cutting edge of technology. They are both really powerful.

Until recently, the Ruby community did not have a really solid IDE. However, RadRails is fast becoming that IDE.

Ironically, RadRails is based on the open source Eclipse IDE. So, basically, the leading Ruby IDE is written in Java.

All irony aside, that IDE is pretty good for writing/debugging/testing Ruby applications.

RadRails is not done yet, though. It still has a way to go before it reaches version 1.0 and has supported all the features that it eventually should. However, it has already received a major software development tool award.

By next year sometime, RadRails will probably be as good a Ruby On Rails and Ruby IDE as Eclipse is for Java. And it will probably have better support for Ruby-based web development than Eclipse offers for Java-based web development.

0 Comments:

Post a Comment

<< Home

Related pages and news

Add this blog to my Technorati Favorites!
Click here to join ruby_programming_group
Click to join ruby_programming_group