From: "David A. Black" Date: 2008-06-11T14:55:47+09:00 Subject: Re: accessing class variables from the outside (beginner question) Hi -- On Wed, 11 Jun 2008, Ryan Davis wrote: > > On Jun 10, 2008, at 05:01 , Robert Dober wrote: > >> On Tue, Jun 10, 2008 at 9:16 AM, Ryan Davis >> wrote: >>> >>> On Jun 9, 2008, at 22:15 , David A. Black wrote: >>> >>>> Class variables [...] in most cases aren't what you want to use anyway. >>> >>> While probably true in this case, I think this statement is dangerously >>> loaded... Your words have sway and affect design decisions. Sometimes >>> class >>> variables are exactly the right tool for the job: >>> >>> % find */dev/{lib,test} -name \*.rb | xargs grep -l @@ | wc -l >>> 50 >> >> May I suggest to trust David more than grep ;). I do not know of any >> usecase where class variables are the *right* thing to use, but I am >> eager to learn, so please enlighten me. > > that is a grep on MY code... I trust my code more than I trust your trust. :P Also, I'm not saying that there are no uses for class variables. And grep is our friend; it's how we demonstrate, for example, that camelCase variable names are virtually unheard of :-) I'll stand by my "in most cases", though, with regard to class variables. David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin ADVANCING WITH RAILS July 21-24 Edison, NJ See http://www.rubypal.com for details and updates!