On Tue, Sep 8, 2009 at 1:38 PM, Peter Boughton<[email protected]> wrote: > Though this one is not just the CF community - plenty of people all round > don't really know what Singletons (and even design patterns in general) > actually are.
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. For CFML, we have "application startup" where we can create our one instance and we have application scope where we can make that one instance available "everywhere". For any language that has a global scope and a well-defined application entry point, implementing the Singleton DESIGN pattern is pretty much trivial. Implementing a design pattern doesn't have to be complicated if your language provides a clean way to do it. 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. -- Sean A Corfield -- (904) 302-SEAN Railo Technologies US -- http://getrailo.com/ An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:326117 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

