in reply to Re^2: Log::Log4perl and singleton design issue
in thread Log::Log4perl and singleton design issue
There is no reason that the global in question cannot be an object. And no reason that object shouldn't actually represent a pool of things, performing locking, or whatever else you might require under the covers.
Global is about scope, not encapsulation. If the resource has application wide usage, there is no reason that it should not have application wide scope. That the resource is an object (or represented by an object) is neither here nor there.
Once you accept that an object that has application wide scope, is just a.n.other object with global scope. It's just another object that gets instantiated early in the program and lives for the life of the program. How it is implemented, a single thing, or a pool of things is irrelevant.
The 'singleton pattern' makes a special case where no special case is needed.
Of course, if the needs are simple, then I'd probably use a glob for logging, and if the needs became more complex, then I'd tie the glob.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Log::Log4perl and singleton design issue
by exussum0 (Vicar) on Dec 19, 2004 at 20:04 UTC | |
by BrowserUk (Patriarch) on Dec 19, 2004 at 21:13 UTC | |
by brian_d_foy (Abbot) on Dec 20, 2004 at 11:20 UTC | |
by exussum0 (Vicar) on Dec 19, 2004 at 22:08 UTC | |
by sauoq (Abbot) on Dec 19, 2004 at 23:14 UTC | |
by Aristotle (Chancellor) on Dec 21, 2004 at 04:10 UTC | |
| |
by daddyefsacks (Pilgrim) on Dec 19, 2004 at 23:23 UTC | |
| |
by exussum0 (Vicar) on Dec 19, 2004 at 23:29 UTC | |
|