Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementation patterns: Java v.s. Ruby

 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Greetings,

Gian
 
Kent Beck
author
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Regards,

Kent Beck
Three Rivers Institute
 
James Dekker
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kent,

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 = Object.new

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic