in reply to Re^7: what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?
in thread what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?
I really don't buy this "singletons sucks" stuff, at least for configuration object :)
For me the problem is that if there are dozens of:
my $config = MySingletonConfigurationClass->instance; my ($foo, $bar) = ( $config->foo, $config->bar );
sprinkled all around my code overriding things for testing, tweaking configuration based on the context, etc. all become much harder than if I'd passed in my own configuration object, used dependency injection, or whatever.
Most people seem to use singletons as big-fat-globals in disguise - and give themselves (or the poor souls who have to maintain their code) all the problems that globals give you.
Take a look at http://del.icio.us/adrianh/singleton for some singleton rants.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: what is a propper way to make a chunk of data accessible to all my packages for retrieval and modification ?
by wazoox (Prior) on Mar 07, 2006 at 12:53 UTC | |
by adrianh (Chancellor) on Mar 08, 2006 at 11:20 UTC | |
by wazoox (Prior) on Mar 08, 2006 at 12:38 UTC | |
by adrianh (Chancellor) on Mar 09, 2006 at 10:50 UTC | |
by wazoox (Prior) on Mar 09, 2006 at 15:04 UTC | |
|