Ruby vs. Java Myth #5: It's a zero-sum game

Previous Myths:

  1. Project Size
  2. Ruby feature X makes code unmaintainable
  3. Ruby is too hard
  4. It is easy to copy Rails' good ideas

Ruby is a great language, Java is a great platform. With Ruby running on a Java Virtual Machine, you get the best of both worlds.

As a language, Ruby is superior to Java for most general purpose programming tasks, as implied here, here, and here. (Some people disagree, mostly for reasons I have already covered under myths one, two, and three.)

As a platform, Java wins hands down. Until recently, Ruby's platform was simply the interpreter (MRI). Want to know how it works? Read the source code. Java provides a much better platform, including

  • a byte code instruction set
  • a portable class file format
  • powerful threading support
  • a thorough security model
  • lots of proven deployment options

Plus Java has more implementations than you can shake a stick at, running everywhere you want to be.

So can't we all just get along? I want to live in a world where language preference does not define a programmer. We'll write code in Ruby, or Scheme, or Scala, or Erlang. And we can all live in harmony on a JVM anywhere.

Want to help create this world? Here are some steps you can take:

  • Contribute to the JRuby project.
  • Write some parts of your next Java application in JRuby. Your dependency injection framework should make this trivial to integrate. If it doesn't, get a new one. You can even get a static typing methadone shot by making your JRuby code conform to a Java interface.
  • Manage your Java application with rake instead of ant (and contribute some code to help others do the same). I have yet to meet a single developer who prefers ant to rake. As I often say, WWJDDD?
  • Unit test some Java code in JRuby Test::Unit.

Happy coding!

Get In Touch