That's how I'm using the singleton object. What I'm curious about is best
practices in referencing the singleton from within other objects. Normally
you create the object to know nothing about the outside world, but it seems
like in this case it might be overkill.

Thanks


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Jack Lavender
Sent: Monday, January 17, 2005 10:26 PM
To: [email protected]
Subject: RE: OO Purity or Overkill

I have no idea how the OO stuff in Cold fusion works.  No contract to do so,
so have not taken time to do it.

But the singleton pattern gives you one and only one of these objects in
your application by making the constructor private and provided a "static"
function that gives access to the allocate object on the heap.
  
Or I should say I have done this per the GoF (Gang of Four) Singleton Design
Pattern in both Java and C++.




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Daniel Elmore
Sent: Monday, January 17, 2005 9:57 PM
To: [email protected]
Subject: OO Purity or Overkill

I'm working on my first OO application and wanted to make sure I wasn't
breaking any OO doctrines. I have a singleton object loaded into the
application scope which has settings that tell many of the other objects
what to do. So, would it be so bad to reference that singleton directly in
the other objects. Like: application.singleton.getSomeValue(), or should I
pass in a copy of the singleton to the other objects and let them work from
it within the arguments scope.

I would really appreciate your experience and words of wisdom.

Thanks
Daniel Elmore

----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm




----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm



----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to