#default vs. #current

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

#default vs. #current

Jeff M.
Simple question:

What's the phylosophical difference between these for singletons?

Thanks!

Jeff M.


Reply | Threaded
Open this post in threaded view
|

Re: #default vs. #current

Support at Object Arts
"Jeff M." <[hidden email]> wrote in message
news:[hidden email]...
> Simple question:
>
> What's the phylosophical difference between these for singletons?
>

This is covered in the Singleton pattern entry that you can find in the
Dolphin Pattern Book (which is Appendix B of the Education Centre).

Regards

OA


Reply | Threaded
Open this post in threaded view
|

Re: #default vs. #current

drozenfa
In reply to this post by Jeff M.
> What's the phylosophical difference between these for singletons?

IMHO, from a conceptual point of view, none of these selector is
appropriate for a Singleton.  While they provide a global access point,
both #current and #default imply there might be some other instances
(not current or not default) of the same class.
Singleton's intent is: "Ensure a class only has one instance, and
provide a global point of access to it.".

IIRC, there is some discussion about this topic in this nice book:
http://www.amazon.com/Design-Patterns-Smalltalk-Companion-Software/dp/0201184621/sr=8-1/qid=1158603467/ref=sr_1_1/102-4769576-8613767?ie=UTF8&s=books

I prefer to use #instance in my own code.

Best regards,
Dan


Reply | Threaded
Open this post in threaded view
|

Re: #default vs. #current

Sebastián Sastre
I've never thought about that. That's really formal Dan,

  cheers,

Sebastian