From: Gary Wright Date: 2009-07-23T02:26:56+09:00 Subject: Re: Instantiating classes / sharing data between classes On Jul 22, 2009, at 12:11 PM, Chris Rhoden wrote: > class Doctor > def modalities > @@modalities ||= your stuff > end > end I think reaching for class variables is almost always a mistake. Some alternatives that I would consider first: a) Use a constant: class Doctor Modalities = query_for_modalities end b) Use a class method and lazy load the data class Doctor def self.modalities @modalities ||= query_for_modalities end end I don't recommend class variables because their actual scope is very non-intuitive (class hierarchy scope, not class scope) and they add to the semantic load of a design when plain old instance variables (on the class object) will do just fine. Gary Wright