File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Agile and Other Processes and the fly likes Implementation patterns: Java v.s. Ruby Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "Implementation patterns: Java v.s. Ruby" Watch "Implementation patterns: Java v.s. Ruby" New topic

Implementation patterns: Java v.s. Ruby

Gian Franco
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hello Kent Beck,

What is your opinion with regards to the often heard comments nowadays that Ruby is more productive, concise, expressive, flexible than Java?

Do you think these are plausible comments, and that therefore excellence in programming is achieved better in Ruby than in Java?



"Eppur si muove!"
Kent Beck
Ranch Hand

Joined: Nov 07, 2003
Posts: 45
Dear Gian Franco,

I haven't programmed in Ruby so I don't have personal experience. However, I have programmed for many years in Smalltalk. There are design thoughts I can express easily in Smalltalk that I can't in Java and vice versa. One aspect of Java I find frustrating is that there is seldom a short, sweet way of saying anything. By the time I have spelled out all the types and parentheses and for loops my one little thought has turned into four lines. I often find concise ways of expressing myself in Smalltalk, and from what I've seen of Ruby it is similar.

Fundamentally, though, communicating through code is a choice. I can program with an awareness of how people will read the code in any language.


Kent Beck
Three Rivers Institute

Author of <a href="" target="_blank" rel="nofollow">JUnit Pocket Guide</a>
James Dekker
Ranch Hand

Joined: Dec 09, 2006
Posts: 221

Java is not pure OO... It has primitives (although autoboxing in JDK 1.5 helps with the problems of primitives). Ruby and Smalltalk are pure OO (meaning everything is an object), on the other hand.

Java is basically an improved syntax similar to C++ with the semantics of Smalltalk. Ruby is a mixture of Perl, LISP, and Smalltalk.

You create Ruby objects in the same way you would in Smalltalk by issuing a:

myObj =

and Ruby has closure support (similar to closures in Smalltalk).

It even has built-in Type Inference...

Another great language which supports closures and functional programming is called Scala.

Figured other industry luminaries such as Martin Fowler and PragDave Thomas might have stated great things about Ruby (along with its keen similarities of Smalltalk) with you.

Don't blame you regarding using Java for the language of choice in your book because C#'s syntax is similar to it and not that many people use Ruby as much as they do C# or Java.
[ December 20, 2007: Message edited by: James Dekker ]
I agree. Here's the link:
subject: Implementation patterns: Java v.s. Ruby
It's not a secret anymore!