Chad Perrin: SOB

15 February 2007

The Ruby Experience

Filed under: Geek — apotheon @ 04:27

I’ve always been a little put off by the Pythonic “There Is One Right Way To Do It” ethic. It’s not just because I like Perl, with its “There Is More Than One Way To Do It”.

I’ve had discussions in the past with Pythonistas about the differences between Ruby and Python. I’ve mentioned the fact that I like the Ruby community’s attitude about how things are done, and that I don’t like the Python community’s attitude so much. I have also mentioned that (unsurprisingly) the languages reflect the communities’ attitudes as an implementation of principle — languages tend to accrete communities whose policies match the languages’ policies, after all.

Well, this first impression of Rails 1.2.1 illustrates something essential to that community and language policy of the Ruby language, something I like about it. Specifically, this bit caught my attention:

I’ve mentioned that this is what coding in Rails continually feels like: sometimes it just feels off even though it works and is nicer than other languages, and soon I realize a beautiful Right Way to do it.

In other words, the language tends to encourage elegant, “Right” ways to do things, but you don’t feel like you have a gun to your head demanding you make it happen that way. It’s like the language teaches the attentive programmer, helping him learn for himself how to program better. Python, meanwhile, (generally) just refuses to let your program run if it’s not written the way the language designers have decreed is the Right Way. At least, that’s how it feels, reading about the language, reading the occasional bit of source code, discussing its “benefits” with Pythonistas, seeing direct translations between languages, and even (horror of horrors) once in a great while editing a little Python code.

I definitely prefer something fairly open, that gently guides me toward doing something beautiful, over something that just limits what I can do to a set of “correct” actions. I guess, the way I see it, if Java is the new COBOL, Python is a bit like the new Pascal — if that helps you understand my perspective at all. (As far as I’m concerned, that’s about a 1000% improvement over being the new COBOL.)

I suppose it’s possible that, once I become truly competent with both Ruby and Python (it’ll probably happen for both eventually, though much sooner for Ruby than Python, given my druthers and my plans for the near future), I’ll discover I’m way out in left field somewhere. I have yet to run across a single bit of credible evidence to the contrary, or even a believable claim that contradicts these impressions.

Some, of course, prefer the Python way of doing things — and they’ll surely describe the comparative characteristics of the two languages differently from how I have. Python is “cleaner”, they might say, and Ruby “too much like Perl” (yeah, keep using that “insult” while proselytizing — it just drives me further from Python and closer to Ruby anyway). Meanwhile, the Rubyist might say that Ruby “encourages” and “guides”, while Python “forces” (though, frankly, in truth Ruby users always seem to be among the most open and friendly of any language’s communities, along with a couple of rare other examples, so I’m not sure your average Rubyist would say anything of the sort).

That’s fine, really. Pythonistas and I don’t have to see eye-to-eye. That’s why they’re Pythonistas and I’m not. At least you know some of the reasoning behind my preference for a language like Ruby over one like Python.

note to self: Check out the above-linked blogger’s website, NearbyGamers. Also, come up with a good, secure, private way to share bookmarks across computers automagically.


  1. Glad you liked it. I did Python for a year and a half professionally, and I really like Python as well. You’re right, it has a very different feel: it’s more deliberate, obvious, and explicit.

    TMTOWTDI doesn’t work at all for me, and I think it’s one of the reasons that Perl isn’t very popular anymore. I like that when I read Python there’s not a large variation in coding style to wade through. Ruby is a bit more flexible than Python, but not so flexible it’s incoherent like Perl often is.

    Comment by Peter Harkins — 15 February 2007 @ 08:15

  2. I don’t find Perl to be incoherent at all (intentional obfuscations and merely awful coding aside — as we’d ignore both in any language while discussing the point of readability). What I do find is that TIMTOWTDI enables a far wider range of almost paradigmatic differences in how one achieves a given goal, which can prove frustrating to someone looking to just use what (s)he already knows to understand a bit of code sometimes, without having to learn anything new.

    I think part of the reason I keep coming back to Perl is, simply put, that it keeps providing new and wonderful “mind-bending” experiences akin to what is generally regarded as one of the main reasons to learn many languages. When a different Perlish sub-language is used to achieve the same ends with different economies of scale, performance, maintainability, modularity, and so on, it generally teaches me something new about programming — and, as a result, makes me a better programmer.

    I guess that’s why Perl often seems to be more of a “hacker’s” language, in the non-pejorative sense of “hacker”, than most others: it is a language that has a heck of a lot of potential for helping programmers learn to think differently from the way they already think, many times over rather than simply the obligatory one time of moving to a new language. Since a passion for learning new things, at least within a particular field of study, seems to be central to what differentiates a hacker from a mere daycoder, the shoe fits.

    As I continue to think about it, Perl seems to attract more of that sort of hackish attitude toward programming, while Python seems to attract a more formalized, do the job “right” attitude — and the respective programming language communities of each reflect that. It may also foster more of an outward-looking sense of how a community’s particular language fits in the programming world in Perl than in Python, because Perl is sort of the English of programming languages: it borrows from everywhere, and occasionally even contributes back.

    I’m in danger of rambling at this point, so I’ll cut it short. Welcome to SOB. I’m glad you stopped by and offered your perspective.

    Comment by apotheon — 15 February 2007 @ 02:36

  3. The reason I don’t like delving deeply into Perl is that I don’t seem to learn things that are transferable out of Perl. When I learned Ocaml I learned to think about composability in every part of my designs. When I learned Lisp, I learned to see the AST in every language. When I learn that a Perl operator behaves almost totally differently in a slightly different context, I feel like at best I’ve learned trivia and at worst I’ve wasted my time.

    And some folks do like the syntax, though probably not for the intended reason.

    Comment by Peter Harkins — 16 February 2007 @ 02:20

  4. That’s understandable. I guess I’m just lucky enough to have had a far more rewarding experience using Perl than you have.

    I feel similarly about Python, actually, though for different reasons — like every brush with it teaches me nothing that’s transferable to other languages. It seems too limited to its own little world, too much like wearing a straight jacket that is designed to segregate the programmer from the practices of any other language or community. That’s probably just me, though.

    Comment by apotheon — 16 February 2007 @ 02:34

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License