Hi --

On Mon, 9 Jan 2006, Gregory Brown wrote:

> This brings up an interesting point though.  In Ruby, idioms are more
> than just 'good practice'.  They really do matter, because they are
> our biggest sense of 'security'.  This of course leaves the
> responsibilities in the hands of the coders, but from my experience,
> the majority of the well known applications adhere to good style, and
> their developers are consistant at being idiomatic in their
> application design.  The same can not necessarily be said for the
> majority in other languages.

I agree -- really "Ruby" in the sense we're talking about is more than
just the language; it's also the coding practices, and the fact that
there are ways (including, but not limited to, discussion with other
Rubyists) of making good decisions about what to do.

I have to say, I'm quite surprised that the image of Ruby that's
emerging in this thread is, at least in large part, of a sort of
mine-field that we all have to tiptoe our way through -- as if the
language is a malevolent force that we write programs in spite of, and
in triumph over, rather than in harmony with.  I've never perceived it
that way, and I wish I could find the words to turn the tide for
others.

I guess it comes down to this: worrying that something like dynamic
method redefinition is going to "bite" you, or "shoot you in the
foot", or whatever, at random times, without warning, is a bit like
worrying that your C program is going to erase all the files on your
hard drive.  If you don't want it to, don't tell it to, and it won't.

Most of the real issues in this realm have to do with modifying core
classes.  The main reason not to do this is that if someone else uses
your code as part of a program, your changes will affect their code
too.  Under circumstances where that can't happen, there's no reason
not to.

Meanwhile, other dynamic-programming things -- like defining
method_missing, creating classes batch-wise, whatever -- are cut from
exactly the same cloth as the Ruby that interprets your script in the
first place.  They're an opportunity to think expansively about what
you can do.


David

-- 
David A. Black
dblack / wobblini.net

"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black