On 01.05.2011 02:24, Iñáki Baz Castillo wrote: > 2011/5/1 Phillip Gawlowski<cmdjackryan / googlemail.com>: >> Maybe a configuration Hash is an acceptable compromise between lookup >> speed and mutability? > > Humm, yes, having a HASH constant containing a hash is faster than > accessing instance variables within a class. Just a bit, but faster :) You never mentioned a performance problem you are trying to solve. Could be that you are worrying too much about an irrelevant detail. > So I'll use it, something like: > > module MyApp > CONFIGURATION = {} > end This might be a corner case but I would generally advice to not use global variables (or constants) for this. The reason is simply that you oose a lot of flexibility. You can only ever have one active configuration at a time - and you cannot change it concurrently as well. It may be OK for a small script or application but if you make that design a habit you might run into problems later. Generally it is better to provide configuration and other information from the outside because that also makes testing easier. You can pass in whatever mock you want to use to test a particular feature. If OTOH instances decide themselves where to get the information from (i.e. the global variable / onstant) you are out of luck (or you need to patch methods of the class nder test while testing which is generally not a good idea because then ou don't test any more what will be productive eventually). Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/