A criticism of Ruby

In general, I’m really loving working with Ruby on Rails.  (For the non-technical, that is a programming language and development environment.)  I’m astonished at how fast I can build things with it.

But I do have one criticism.  I am frequently finding one certain type of bug that is really annoying to me.  A bug that would not occur in Java or C++ or another strong-typed language.

I  write a valid Rails program.  It fails with strange errors somewhere in the bowels of the Rails infrastructure.  I scratch my head in great puzzlement.  Finally, I realize what happened: I used a variable name that was already used by Rails.  Something like “url” - something that you would expect that I could use.  Ruby never warned me that I was overwriting a Rails variable - that’s perfectly valid.  (Java or C++ would give me a compile error, tell me that the variable already exists.)  Instead, with Ruby things just break.

I change the name of my variable to something a little less general, something like “story_url”.  Suddenly, things work perfectly.

Not only does Ruby on Rails give me no warning, but I have yet to see a set of complete documentation of semi-reserved words (words that I should not use in my Rails application, though the Ruby language allows them).

How annoying!

1 comment so far ↓

#1 Kedar on 06.14.07 at 6:06 pm

hehe.. yeah.. I feel your pain :-) So Rails is getting bitten by the eat-your-dog-food thing.. Rails framework code uses Ruby (I suppose?) and whatever you write in Ruby for your Rails app can clash with the framework code itself? Am I making sense? Maybe this is my ignorance talking. I haven’t started working in this arena that much.

Anyways, nice to know you are enjoying the new environment. I do keep checking your blog from time to time :-)

You must log in to post a comment.