Link Details

Link 105638 thumbnail
User 252611 avatar

By Thierry.Lefort
via blog.taragana.com
Published: Aug 21 2008 / 16:22

I tried delving into Ruby couple of times in the past. Every time I had this weird feeling of what am I doing here when I am already very well conversant with a simpler language - Java, which gives me everything I need.
  • 20
  • 15
  • 1421
  • 589

Comments

Add your comment
User 326816 avatar

dougal replied ago:

1 votes Vote down Vote up Reply

I wouldn't vote for Java either... but Ruby isn't for me.

User 311881 avatar

stugots replied ago:

0 votes Vote down Vote up Reply

I would not defend either Java or Ruby on language syntax grounds, but, this is a dud.

User 200646 avatar

comctrl6 replied ago:

-1 votes Vote down Vote up Reply

Here's a little perspective:

Try printing out the system properties in alphabetical order.

In Java:


import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;

public class Main {
public static void main(String[] args) {
Map sortedProps = new TreeMap(System.getProperties());

for (Iterator itr = sortedProps.keySet().iterator(); itr.hasNext();) {
String property = (String) itr.next();
System.out.println(property + " = " + sortedProps.get(property));
}
}
}


In JRuby:


ENV_JAVA.sort.each { |e| puts e.inspect }
,
,

User 107114 avatar

daniel replied ago:

1 votes Vote down Vote up Reply

If you use generics properly, your Java version will be significantly less verbose:


public class Main {
public static void main(String[] args) {
Map<String, String> sortedProps = new TreeMap<String, String>(System.getProperties());
for (String key : sortedProps.keySet()) {
System.out.printf("%s = %s", key, sortedProps.get(key));
}
}
}


I'll grant that it's still much more verbose than Ruby, but I don't think anyone would claim that Java is a concise language. :-)

User 246164 avatar

www.johnmunsch.com replied ago:

3 votes Vote down Vote up Reply

The millionth iteration of, "This language couldn't be very good because I already know this other language really well."

Seriously, there's nothing wrong with advocacy, I've done my fair share of it as well. Either defend something you like against unfair attack or demonstrate something it does really well. That is, perform advocacy by showing advantages.

Making idiotic speed comparisons between a compiled language and an interpreted one just makes you look simple. The Ruby people will come up with a dozen things that are impossible in a compiled language and trump any argument you make like that. That's because each one has different strengths and different uses for which it is appropriate.

User 201685 avatar

lnguyen replied ago:

0 votes Vote down Vote up Reply

This is pretty weak sauce. I would like to read another iteration by the same author.

User 327435 avatar

stalky replied ago:

0 votes Vote down Vote up Reply

Ruby, like Perl before it, seems to make keystroke minimization a high priority. Why is printing a sorted list of properties in alphabetical order in 1 line a worthy goal?

Complexity is the enemy of software systems, not an excess of keystrokes.

User 326816 avatar

dougal replied ago:

0 votes Vote down Vote up Reply

One of the strength in Ruby is the condensed syntax. Java has strengths in other areas. It's that simple.

Re: stalky. I agree however I think its stated nicely in the Python Zen

"Simple is better than complex.
Complex is better than complicated."

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.