> Remember that Singleton is a DESIGN pattern. The complexities we see
> in much of the published literature are based on Java's inability to
> cleanly implement a secure Singleton design because it doesn't have a
> global scope and any real sense of "application startup". Don't mix
> design and implementation.
...
> If you're fussy about encapsulating the single instance in a method
> call in CFML, just add an instance() method that returns
> application.theSingleton - but this is already overly complex and
> unnecessary in my mind, forcing you to trade off some of the
> high-level simplicities CFML brings to the table in exchange for a
> "purity" that adds no value.
I'm not sure I would say it adds no value. I think it depends on the
goal of the project. I'm working on a project right now that does
essentially this, except it's returned from init(), not from a separate
instance() method. The reason in my case is to eliminate a dependency,
making the project an optional / scaling addition, rather than a
prerequisite. Figuring out how to put a singleton into Railo's cluster
scope was kind of interesting too. ;)
--
s. isaac dealey ^ new epoch
isn't it time for a change?
ph: 817.385.0301
http://onTap.riaforge.org/blog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326121
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4