Ruby and Groovy vs. Java

This is why I like modern languages… a good developer knows what he is doing and writes tests anyway, so we don’t need mountains of syntax to provide compile-time safety.

Imagine you are a development manager looking at this:

Ruby

def get_types
  words.collect{|word| word.word_type}
end

15 seconds to code.
3 seconds to read and understand.
Easy to read = self documenting.
Less LOC = better codebase and more agile team.

Java

public List get_types {

  List word_types = new ArrayList();

  for (Word word : words) {
    word_types.add(word.getWordType());
  }

 return word_types;
}

1:10 seconds to write.
8 seconds to read… harder to interpret.

Which is leaner and meaner?

Java – stop making me think for simple operations!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s