(This is a snapshot of my old weblog. New posts and selected republished essays can be found at raganwald.com.)

Tuesday, January 22, 2008
  Ruby is soooooo 2002

I first heard about Ruby when Matz spoke at LL2 in November, 2002. I experimented with it on and off over the next few years, and I liked it. I also experimented with C#, Groovy, and a few others, but Ruby reminded me of Smalltalk, a language I used in the 80s and loved, so I stuck with it even though I seemed to be one of three people using Ruby without using Rails.

Lately, the internet echo chamber is souring on Ruby and moving from embracing it to hating it. I suspect that although people are quoting all sorts of technical reasons for their dislike, it comes down to cultural forces. Shrug.

I am reminded of the time I showed up in high school one September on a skateboard. To give you an idea of where skateboards were in those days, my model had clay wheels designed for wood-rink roller-skates, not the polyurethane we have today. Any ways, everyone laughed at me. The next Summer, everyone had one, and they were laughing at the fact that I didn't ride the latest model, even though I was a more accomplished free-styler and slalom rider. Then, the fad passed, and I was the iconoclast again, still riding my board while everyone embraced mopeds.

Guess what? There is no villain in the story. I was happy riding with my friends. The people who jumped on and off fads were happy, and they were learning important life skills about participating in human culture. And the fad was a big win: Early boards really weren’t very good, and the popularity brought money and manufacturing scale to skateboarding that improved the technology.

Paul Graham has said that the real world is nothing like high school. I’m not so sure.

I often use Ruby for code examples. What do you think: Should I continue using Ruby, or should I use another language for examples? If I continue using Ruby, should I try to show idiomatic Ruby or should I try to focus on general ideas that can be applied elsewhere?

Code examples should be:
Anything but Ruby
Ruby, but general
A mix of specific and general ideas
pollcode.com free polls



Comments on “Ruby is soooooo 2002:
Surely it depends on the subject matter of the post. If you're describing something that's ruby specific, then go hog wild with idiomatic ruby.

If you're describing something of more general utility, use more generic language (ruby, java, pseudocode, or whatever language suits the problem domain).

Or just use Perl for everything, then everyone will love you.
>Lately, the internet echo chamber is souring on Ruby and moving from embracing it to hating it.

I got the impression that it soured not so much on Ruby (or even not at all) as on Rails. The widespread opinion of Ruby still seems to be fairly positive on the language, and overwhelmingly negative on the runtime.

>I often use Ruby for code examples. What do you think: Should I continue using Ruby, or should I use another language for examples?

Do what you want, and what works for you.

But I don't think there's any reason for you to switch away from Ruby if you enjoy it. Unless, of course, you'd switch back to Smalltalk (which would be mighty cool).

>If I continue using Ruby, should I try to show idiomatic Ruby or should I try to focus on general ideas that can be applied elsewhere?

I think your current mix is quite good.
For the record, I program professionally in Ruby (without Rails). Other people on my team write Ruby with Rails.

Ruby has many excellent features, like blocks, metaprogramming, map, filter, etc. The thing that has driven me nuts about people extolling Ruby's virtues is that they never mention all of its little quirks, like perl's global variables ($!, $? $^ $@), etc. Or how there are 6 or 7 different proc objects. Or how the syntax is so incredibly complicated to handle all the special cases. Ruby's parser is a 6000 yacc file. yuk.

At this point, Ruby has enough in common with Lisp that I wish people would just use a good lisp (like PLT Scheme, for example), and lose all the annoying little quirks.
I'll be totally selfish and ask for examples in Ruby _and_ C#. :)

The thing that has driven me nuts about people extolling Ruby's virtues is that they never mention all of its little quirks

Like this? I remind you that my first skateboard had clay wheels :-)


You want we should play both kinds of music for you?
Let's compromise. Just do the examples in IronRuby. ;)
Re: code examples

I started tracking your blog because it had a lot of those interesting tidbits about ruby that I might not have run into. To me your blog was a ruby blog with some general programming.

Re: souring on Ruby

I agree with Masklinn. It seems that rails is starting to get a bad rap, but since it is Ruby on Rails people throw out the baby too.

What I think I see from Ruby on Rails hate is that it is a victim of its own success. It's so easy to create things in Rails that it has attracted the masses and now the cool kids are annoyed that their club isn't exclusive.
Ride your skateboard man, write the code in whatever floats your boat.
I have always viewed your blog as a general blog about various interesting things that _real_world_ cs people run into, with a healthy bit of academic knowledge thrown in. IMO it has not been a ruby blog, just that you prefer ruby for your code examples. I try and focus on the code rather than the ruby which I hate for various reasons most of which have to do with 'its not python'.
Whether or not the echo chamber is getting over Ruby, it has certainly served its purpose in bringing functional PLs back to the forefront of 'hey its interesting'.
I think there's a good argument to be made that Ruby makes for just about the best executable psuedocode out there

Most of the Ruby hatred is based on Rails' popularity/evangelism and the current sad state of the standard ruby interpreter. Neither of these should be lasting problems
I'm an intermediate/advanced Ruby programmer who's been working in it the past couple years, but I glazed over your last couple of blog posts that contained Ruby. The problem is that you like metaprogramming, as you should, except it's horrible to read in Ruby. Everyone complains about the inconsistency with procs, and I agree with them.

More than that, however, I can't stand any time I need to dynamically define anything syntactically. class_eval is like writing macros post-expansion. You mix all that together with monkey-patching and if you get an abstraction that leaks, good luck trying to figure out how to plug it up. I can't tell how many hours I've pored over routing.rb and dependencies.rb in Rails trying to figure out why I was getting an error that was due to me assuming the abstraction worked the way it presented itself.

Then there's the fact that every Ruby library out there packages itself differently. This is one area where I think Python has had it right all along and I only noticed it a few months ago (and have been much happier). You crack open a file, look at its imports -- instant documentation where to find modules. With Ruby, who knows the canonical location of anything. Ruby copied a lot from Smalltalk, but it didn't copy the part that makes it all work: its environment.

Helpful redditors pointed out that I can use ruby-debug now to alleviate a lot of these problems, and that's good. However, I'm just sick of the whole ball of wax. The community of ex-PHPers, the dismal performance, the lack of a benevolent dictator, the lack of lexical scope, the lack of a syntax whose quotes can successfully be parsed by elisp (:-)), the comparable lack of a maturity in a language that's been around as long as Python -- all just eat at me every time I work with it.

I think it's become the whipping boy lately because of people like me. They finally found something better than Perl and thought Rails would be the critical mass to push it over the edge, but it's just become more of a steaming turd with every new book about Rails by any yutz with a blog. I have little hope for anything positive other than perhaps Rubinius.

Anyway, back to your blog. I vote for Scheme instead. It's perfect for the type of content you write. There's really no paradigm at which it does not excel, and there's very little language to get in the way for people that think they don't know Lisp. Plus it'd be good for people to learn it.

If not that, then Python.
It's your blog; you can cut your code in any way that tickles your brain.

Appart from that, if some other language fits the bill better for solving a given problem, then go with. For instance, I never quite got how quicksort worked until I saw a version in Haskell, then it just clicked, clear as day. Likewise, if you want to show how one can churn out a new DSL at the flick of a wrist in Ruby, then go right ahead.
The few recent examples were very Ruby specific, so those were probably appropriate. For general examples, it would be nice to have them in "understandable" form such that people who mainly use other languages with similar constructs can follow them, just knowing how those language concepts are defined in Ruby (e.g., how to define a lambda). But, I still think the Ruby-specific code that I can't necessarily follow is interesting, since it exposes me to how one particular language solves an interesting problem.
I use ruby without rails. Mostly for cronjob tasks. Not because I hate rails, but because ruby has absolutely the worst web deployment.

PHP is so easy to deploy. You install mod_php and you drop your php files somewhere in the webroot. Each php script runs in its own runtime. You don't have to worry about conflicts between two separate scripts... scripts get wiped from ram as soon as they're finished running.

Rails requires special daemons and crazy rewrite rules for apache. eruby is dead... but even when it was alive it was a pain. Scripts shared runtimes and one script could screw up another script.
Huh? This is a Ruby blog? Read it for so long and never noticed. :?
re: your poll about language for code examples

Reg, I say use the language that most elegantly demonstrates the example. This might give people language envy and want to try it out, given how beautiful the example is vs. how they might have to implement it in their favorite language, Blub.
You could always just use our good old friend PseudoCode... :)
I'll vote for Scheme or Smalltalk, though I only know the former.

<< Home
Reg Braithwaite

Recent Writing
Homoiconic Technical Writing / raganwald.posterous.com

What I‘ve Learned From Failure / Kestrels, Quirky Birds, and Hopeless Egocentricity

rewrite_rails / andand / unfold.rb / string_to_proc.rb / dsl_and_let.rb / comprehension.rb / lazy_lists.rb

IS-STRICTLY-EQUIVALENT-TO-A / Spaghetti-Western Coding / Golf is a good program spoiled / Programming conventions as signals / Not all functions should be object methods

The Not So Big Software Design / Writing programs for people to read / Why Why Functional Programming Matters Matters / But Y would I want to do a thing like this?

The single most important thing you must do to improve your programming career / The Naïve Approach to Hiring People / No Disrespect / Take control of your interview / Three tips for getting a job through a recruiter / My favourite interview question

Exception Handling in Software Development / What if powerful languages and idioms only work for small teams? / Bricks / Which theory fits the evidence? / Still failing, still learning / What I’ve learned from failure

The unary ampersand in Ruby / (1..100).inject(&:+) / The challenge of teaching yourself a programming language / The significance of the meta-circular interpreter / Block-Structured Javascript / Haskell, Ruby and Infinity / Closures and Higher-Order Functions

Why Apple is more expensive than Amazon / Why we are the biggest obstacles to our own growth / Is software the documentation of business process mistakes? / We have lost control of the apparatus / What I’ve Learned From Sales I, II, III

The Narcissism of Small Code Differences / Billy Martin’s Technique for Managing his Manager / Three stories about The Tao / Programming Language Stories / Why You Need a Degree to Work For BigCo

06/04 / 07/04 / 08/04 / 09/04 / 10/04 / 11/04 / 12/04 / 01/05 / 02/05 / 03/05 / 04/05 / 06/05 / 07/05 / 08/05 / 09/05 / 10/05 / 11/05 / 01/06 / 02/06 / 03/06 / 04/06 / 05/06 / 06/06 / 07/06 / 08/06 / 09/06 / 10/06 / 11/06 / 12/06 / 01/07 / 02/07 / 03/07 / 04/07 / 05/07 / 06/07 / 07/07 / 08/07 / 09/07 / 10/07 / 11/07 / 12/07 / 01/08 / 02/08 / 03/08 / 04/08 / 05/08 / 06/08 / 07/08 /