Thursday, May 14, 2009

Scala over Ruby - My Debate Ends

I've maintained posts about things I like in better about Scala and/or Ruby, but, it's time to put an end to the debate. I've been doing Ruby every day for almost 6 months now, and finally conclude that for me, it just doesn't feel nearly as nice as Scala. It's not ever close, to be blunt.

My main reason? Refactoring. Over the years I've become very good at refactoring; I've actually been called a refactoring machine. I have a lot of experience refactoring really, really terrible code. Yes, this sucks, I have a history of picking the wrong job. Fortunately though, I also have some experience refactoring really nice code as well. The code that I'm working on now in Ruby is fairly new, and quite good. All the Scala code that I write is pretty good (room for improvement, but pretty good).

I can refactor so easily in Scala with huge confidence and I can't do that in Ruby at all. In Ruby:

  • It takes a long time to make major refactorings.

  • I'm never fully confident in my refactorings and almost always get annoyed by runtime errors.

  • Sometimes the stack traces are all messed up and I can't figure out where my actual error is.

  • Most code you run into isn't going to have enough test coverage to help anyway.

  • For all the preachers of TDD and instant feedback - tests untimately/inevitably take (far) longer than the compiler. So I really don't have the instant feedback I need.

  • If you skip refactorings in Ruby because they are hard, your code becomes harder and harder to refactor. This goes for statically typed languages as well, but, it's a lot harder with Ruby, especially considering the points above.

  • Ad infinitum...

In my next post I'm going to cover a bunch of major refactorings I just did to my Lexer, and how easy it was.

5 comments:

  1. So you got a job to work on Scala?

    ReplyDelete
  2. no. i dont think i suggested that, did i? i'm not looking for a new job. im more focused on returning to school.

    ReplyDelete
  3. totally agree with this article

    ReplyDelete
  4. Kinda thin, Jack. Could you provide some actual examples, or even anecdotes? From here it looks like this is a fancy way of saying "I like Scala" which is fine. I like vanilla ice cream. See what I mean?

    ReplyDelete
  5. Thin indeed. All feeling? I don't think so, but certainly some feelings are involved and I do like Scala a lot more. I don't really have time to document it, especially now that I'm no longer writing Ruby and I'm doing Scala full time. I think most of the stuff I wrote is pretty well known and written about. I found most of the time my Ruby code was write once, and pray you made the right design decisions and don't have to refactor. I don't feel that way with Scala. I'm not claiming this isn't thin, which is why I said, "My" debate ends, and said things like, "for me". I did this intentionally as to not say Scala is indeed better. I don't want to get into battles like that. I do think Ruby has it's place and I think that if you just want to satisfy your business by getting boring, easy web apps done, and done quickly (but not fast), Rails is a great choice. I HATE writing webapps, so that might be another reason why I shy away from Ruby/Rails. I want to study languages and Scala certainly more academic. Studying Ruby for a while was helpful though, to my purpose, and I appreciate the time I spent with it. I'm done though.

    I've always maintained that I like Ruby, btw. You can see my other posts. I certainly enjoyed it more than Java.

    Hopefully that gives you a little more insight into where I'm coming from and my motivations for writing this post. Sorry it was thin. I have a lot of work to do.

    ReplyDelete