Peter, I understand the singleton pattern. It's lovely, on a cloudy day or sipping some tea or whatever, but in CF, don't you think that implementing the true singleton pattern is overkill and generally unnecessary? Consider our lack of true constructors, the stateless nature of the web, and multiple server configurations that many of us use. Honestly, I'm just interested in your opinion.
Or, are you just saying we throw the word around like candy at a parade and should stop before we hit someone in the eye? What then should we call it? nathan strutz [Blog and Family @ http://www.dopefly.com/] [AZCFUG Manager @ http://www.azcfug.org/] [Twitter @nathanstrutz] On Tue, Sep 8, 2009 at 10:59 AM, Peter Boughton <bought...@gmail.com> wrote: > > >Just a quick thought: If, for example, you are building reusable, > >singleton components (sorry for the OO buzzwords, but it is descriptive > >terminology), then you can load those CFCs into Application scope and have > >them exist in memory only once but still be used across all requests in > the > >app. > > Putting a CFC in the Application scope is *NOT* creating a Singleton. > > A CFC in the Application scope is an instance of that object, but there is > nothing stopping you creating multiple instances of that CFC - whether still > in the Application scope or other scopes. > > A Singleton is an object that *can only have one instance*, returning that > same instance even if you try to create a new instance. > > And, particularly with OO, the times when you actually want an enforced > single instance are rare - so if someone starts talking about Singletons, > there's a good chance they've misunderstand OO's concepts. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:326099 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4