tags:

views:

568

answers:

8

I am a beginner to Ruby. I've heard the following complaints about Ruby, and was hoping the Stack Overflow community could address each point raised.

Common complaints about Ruby that I've heard:

  • Ruby is slower than Java
  • Ruby is not statically typed
  • It's not suitable for large projects

Given these admittedly opinion based statements, how is Ruby 'better' than Java? and will Ruby ever be a widely used language both by businesses and individuals?

+1  A: 

Ruby's speed has greatly increased in the latest version. Though in older versions Ruby is slower than other scripting languages.

Ólafur Waage
All of the Ruby implementations shown in the current benchmarks game are more recent than the versions shown in that blog article - they are not older versions! (ruby 1.8.7 ruby 1.9.1p0 jruby 1.2.0)
igouy
A: 

Ruby is a popular language already :)

I don't agree with you on "We should always think about the performance" and "ruby is better than java". On some project, code readability may be more important than performance. Think of optimized C++ code which no one can read and maintain for example. And there is no perfect proof that "Ruby is better than Java". Where did you take that information ?

m3rLinEz
http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/Here is the link which says for an iteration it takes 86 ms. So if it is a large project then my application experiences slow.. Customer wants only performance. He dont care how clearly it wrote.
Manoj
It's true that on some projects the performance is what customer want. But it's not true that performance is the only concern. How about customer who wants his application modified regularly ? The maintainability is important here.If you want only performance I suggest going with C++ :)
m3rLinEz
C++? Slow. Assembly would be better, machine code probably best. Of course, it might not get delivered until the 22nd century...
Mike Woodhouse
+1  A: 

The answer to the question "which language is better, this or that?" is always subjective. Sure, objectivity is valid and you can somehow reach a conclusion about a language being better for X task/project.

However, even then, if your team is happy with some other language that is not the first choice for a certain task/project, but the work can be done anyway... a wise team will choose the language that makes them happy because their productivity will also be greater.

Concluding, no one can tell you his choice is better than your choice. They can try to persuade you, but if for some reason X language makes you more excited, they cannot do anything about it.

Having said that: Ruby 1.9+ has improved a lot as far as performance is concerned. If you ask me, my biased opinion is choose Ruby because I like it. But if you wanted an unbiased opinion, we would have to discuss more aspects and examine what exactly you want to do with the language/framework etc.

Petros
+1  A: 

I advise you to try both languages and then decide which you think is best.

willcodejavaforfood
+1  A: 

For some purposes, Ruby is too slow in operation. For others, it's fast enough.

For some purposes, Java takes too long to develop.

For some applications, static typing is unnecessary, for others it's highly desirable.

The size of the project is largely irrelevant.

In some ways, Java is better than Ruby, in other ways Ruby is better than Java. Anyone who maintains that one is "better" in any circumstance probably doesn't know enough about either to hold a valid opinion.

And what about JRuby?

I think it's fairly well-documented by now that Ruby is "popular". Not as "popular" as Java, C++ or C, for example, but popular nonetheless.

See

Mike Woodhouse
A: 
how is Ruby 'better' than Java?

It's not, and Java isn't 'better' than Ruby. Both have their pros and cons, and it depends on your project; what is the best tool for that job.

Adam Jaskiewicz
Please tell me the pros of Ruby..
Manoj
+4  A: 

Ruby is slower than Java to run but faster to write, or read. Which is more important to you? I don't know any company in the world who'd pass if given the opportunity to (say) cut their dev time in half at the cost of doubling their hardware.

Ruby is not statically typed, but neither are Python, Perl, Lisp, shell scripts, etc. Is this really a problem for you? I'm sure you could find just as many people in dynamic languages who would complain that Java, C#, C++, etc., are statically typed. We've no lack of examples of systems built on dynamic languages.

I'll agree that Ruby isn't suitable for large projects, but neither is any other language we have today. The state of software engineering is pretty clear to me: nobody can reliably build large systems well. At least Ruby makes your large projects smaller in lines-of-code, which makes them (somewhat) more manageable. It's syntactically richer so you can say (something closer to) what you mean. It's faster to write so you'll find out quicker if you're going down the right path or not.

If these are the best arguments against Ruby, then Ruby is doing better than I'd thought.

Ken
A: 

Depending on what you need to do.

We expect our code to run for decades. Staying with pure Java means that we are pretty certain that the technologies will stay "in fashion" and that future colleagues can maintain the code. Going for the language of the day, will eventually mean that you will have programs written in languages which have gone out of fashion and therefore is more difficult to maintain.

"Pure java" basically means we are staying with the standard Java Runtime, and implementations of Sun specifications (like JavaServer Faces). It is not as boring as it sounds :)

Thorbjørn Ravn Andersen