From: John Joyce Date: 2007-10-19T12:55:52+09:00 Subject: Re: Class instance variable idiom Well, I have to agree there are some odd things about Ruby's class variables, and they're not terribly useful most of the time, but in the cases where they are useful, they are useful. Unless you need to count the number of instantiations of a class, I can't imagine what else to use them for. But perhaps this kind of counter of class instantiations ( minus GC'd instances ) should be built-in to all Ruby classes and accessible via a method. Or at least the ability to create that count without using class variables proper. Then again, is it that useful? It is when it is needed. I do think all the books should generally make a note that most folks will rarely need or want to use class variables. Then each book should explicitly state that instance vars are what you will normally want to use day to day. In the case of subclasses and so forth, choosing where you want to have a class variable is a design issue. While OOP is easy to learn and understand, it is not easy to become good at designing classes. I know. I'm still not good at it.