|
Posted by steve on 10/13/24 11:30
oh, and one example...singletons that simply hold constants...leaving a
clean name-spaced definition of what they are associated with.
"steve" <a@bc.com> wrote in message news:LI98f.20336$RG4.7109@fe05.lga...
| ok...two thumbs down so far for singletons...only one citing specifics.
| singletons are *great* in my opinion. you just know how, when, and where
to
| use them.
|
| the example of using a global variable/function/class to achieve a
| work-in-place-of a singleton is a false notion. while you may achieve the
| same or desired effect(s), you cannot enforce the same scope as a
singleton
| without a lot of programming (and praying that another developer on your
| team doesn't much things up...and understands what you're doing...to which
| end he'd simply say "shit, why didn't this idiot just create a singleton
and
| be done with it!").
|
| and the notion of being pigeon-holed into not scaling is, likewise, a
farse.
| singletons do what they are designed to do. if you had other intentions
from
| the beginning, then design you system differently...else if the
requirements
| change, exactly how much work does it take to convert a singleton into a
| multi-instancing class?
|
| you may want to wait for your book to arrive before assuming either of the
| above reasons make singletons "bad".
|
|
Navigation:
[Reply to this message]
|