Static Typing: For tools, or for compilers? Classpath: *.jar. Finally. Almost
Mar 20

Code-to-learn ratio: Getting work done with Ruby

Ruby, Tech Add comments

I have been working on a fun new project, where I get to work in Ruby.

After spending some time submerged in Ruby land, I am having some interesting thoughts.

The biggest point is that the code-to-learn is very high in Ruby.

You go from thinking “Hmm, I need to send an email in my code….” having never touched an email module, to writing the simple Net::SMTP code in minutes.

This happens with more complicated parts and pieces too, and I find myself spending way less time on websites and Google trying to work out a bizarre issues, and more time writing code to get my work done.

It isn’t all perfect though. I still wish that:

  • I had a JVM (JRuby)
  • Ruby could look ahead and not have to read my def before I use it
  • I admit it. I like { } as delimiters. A lot more than “end end end end”
  • IntelliR :(

That being said, these are all MINOR nitpicks (apart from IntelliR). I am having a great time solving problems at a nice, high, functional level of abstraction.

Oh, and I haven’t had a RuntimeException due to passing in the wrong type yet.

3 Responses to “Code-to-learn ratio: Getting work done with Ruby”

  1. Sumit Says:

    Agree on the “{}”. That and the “def”s keep putting me off any time I try to pick up Ruby.

    Kinda similar with AOP. I’m sure their adoption would have been a bit higher if they had not chosen such stupid keywords.

  2. Daniel Berger Says:

    “Ruby could look ahead and not have to read my def before I use it.”

    This is only true if you’re writing some top-down, bash-style script. And I know that’s not what you’re doing…RIGHT?!

    class Foo
    def test1

    def test2
    puts ‘yo!’
    end # yo!

    Works for me.

    PS – Sorry about the formatting – it seems to strip my ‘pre’ tags.

  3. Jason Carreira Says:

    Check out Scala. It’s OO + Functional like Ruby, but it compiles to JVM bytecode (and also optionally to MSIL for the CLR) and it can use all of the Java libraries natively. I’ve been toying with it this week for the functional stuff, and I really like it.

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'cricket'