Hi -- On Thu, 26 Jan 2006, Alex Combas wrote: > Was just thinking today, earlier, but at the moment > I'm not reallly thinking, I'm mostly asleep right now, > so probably shouldnt be writing, let alone typing, and > especially not with this much Nightquil chugging though me.. > > BUT OK!! > TITLE: Class are objects!?! > Here is my question: Does having class variables (@@) and > class methods (MyClass.foo) destroy the whole OO design concept? > I've always thought of classes like blueprints, and objects like, well, objects > made from the blueprints. So thinking of classes as objects themselves > that have :attributes, @@variables, and def methods kind of wrecks > my "blueprint" metaphore. I agree with Ross that class variables are best avoided, though one does need to recognize them of course. In my view they cut a weird path across what would otherwise be very clear scoping rules. As for classes as objects: one way to think of it is that classes have both a kind of "official" status and a kind of "civilian" status. Sort of the way both parents and their children all have Social Security numbers (in the US, that is), even though in their parent/child relationship they play different roles from each other. Or the way everyone is really at the same level when it comes to medical needs, whatever else they do in society. Classes have a special role in Ruby "society": they are responsible for bootstrapping other objects into existence. But they are also members of that society (i.e., objects themselves); so they can receive messages, own their own instance variables, etc. If you ignore class variables (which I try to :-) classes are actually special-cased in rather few ways. David -- David A. Black dblack / wobblini.net "Ruby for Rails", from Manning Publications, coming May 1, 2006! http://www.manning.com/books/black