Re^6: Log::Log4perl and singleton design issue
by brian_d_foy (Abbot) on Dec 20, 2004 at 11:20 UTC
|
You don't create multiple instances, jsut multiple references. Each part of the program that needs a reference gets its own, so it doesn't have to rely on some other distant part of the program.
For instance, Apache::DBI does this sort of thing so different things happening in mod_perl can share a database connection, even though they might be different applications.
--
brian d foy <bdfoy@cpan.org>
| [reply] |
Re^6: Log::Log4perl and singleton design issue
by exussum0 (Vicar) on Dec 19, 2004 at 22:08 UTC
|
The point is not to hardcode something somewhere. If you wish to use globals, go right ahead. I'm not trying to stop you. Just like you use enapsulation in OO for setters and getters for the flexibility of doing things during sets or gets, it's the same for singletons. It allows you to break the mold. Saying singleton's are useless is like saying sed is useless. If it were useless, people wouldn't use it.
----
Give me strength for today..
I will not talk it away..
Just for a moment..
It will burn through the clouds..
and shine down on me.
| [reply] |
|
|
If it were useless, people wouldn't use it.
Can you make the same argument about neckties?
Neckties are useless, but some people think wearing them makes them more professional.
-sauoq
"My two cents aren't worth a dime.";
| [reply] |
|
|
| [reply] |
|
|
|
|
|
|
|
but some people think wearing them makes them more professional.
and therefore they're not useless.
| [reply] |
|
|
|
|
The traditional necktie, can be used as a tourniquet. Other than taht, they are merely a traditional fashion statement. Two times the usefulness. As Emerald would say, "Bam!"
----
Give me strength for today..
I will not talk it away..
Just for a moment..
It will burn through the clouds..
and shine down on me.
| [reply] |
|
|
|
|
|
|
|
|