Code simplicity

Alex Payne did a much better job expressing this that I could in my slightly addled state:

I enjoy programming in Ruby, but it doesn’t have the crisp simplicity that I prefer. Syntactical shortcuts inherited from Perl combined with upteen different ways to write a given expression make the language extremely flexible, but also extremely complex. It’s possible to write clean, minimal Ruby, but such code rarely takes full advantage of the language. Idiomatic Ruby is powerful but complicated. While Ruby programs are often shorter than their equivalents in other languages, line density frequently offsets length for rapid comprehension.

That’s always something I’ve noticed with Ruby - that it borrows too many “magic symbols” from Perl for my liking. I strongly dislike idiomatic code because reading it is too much like parsing hieroglyphics. To some extent you’re gonna get that with any computer language, and a lot of it is dependent on what you’re used to syntactically, but I do think there are tendencies for some languages to be more or less “readable.” PHP does a pretty decent job of it; I think Python is even better in this regard, and probably why I dig the language a lot.

  • Bertrand Mansion
    12/07/2007 09:32:05 AM

    Try Lua.

  • Michael
    12/07/2007 05:34:11 PM

    That’s some tough calculus. Martin Fowler would argue that expressiveness in a language makes developers more productive. Expressiveness and terseness go hand-in-hand.

    For example, there is a lot of debate in Java about adding closures to the language. Does Java need the expressiveness of closures, or will its terseness make Java code harder to develop/maintain? Closures are common enough in other languages that the expressiveness argument probably wins out. Some of the hard-to-grok terseness of Ruby is from Perl, as you mentioned and not common to other scripting languages like PHP and Python.

  • Edward Finkler
    12/07/2007 10:52:01 PM


    Thanks for the tip. I’ll look into Lua.


    Smarter people than me can certainly make better arguments on this topic. ;) However, I do find that as much as I like closures in Javascript, I also see them making my code harder to maintain. That doesn’t mean I’m willing to give them up, though, because they’re super cool.