The singleton object needs to be known wherever you want it to be used.
Its public behavior is that reference.  

I am not the best guy to comment on "create the object to know nothing about
the outside world", but that doesn't make sense to me.  Probably 'cause it
is late and I am doing a lot of systems work.   When object "interact", then
something must act as a broker for that interaction to take place.
containership and inheritance are used for building some kind of
"relationship".  But to try to force some "overarching" relationship
structure can really be painful, and the Singleton object gets around that
pain.  Singletons can be overdone, like any other technique.




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

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




----------------------------------------------------------
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