On Dec 2, 2015, at 12:24 AM, Luther Baker wrote:

> The conversation here is pretty loose ... and so everyone might be right in 
> what they are intending to convey... ;-) but I thought I'd just put in a vote 
> to stop using the term "Singleton" for this access pattern. It isn't a 
> Singleton (unless there is historical signficance that grandfathers this 
> incorrect term in) and I think that using the term loosely in this case 
> actually weakens the power of a pattern vocabulary a bit.
> 
> Unless you're doing something we can't see (which is possible), it is 
> unlikely you are actually creating a Singleton. It is more likely that you 
> are creating class methods that in some/many/most/all cases - are accessing 
> private static instances. Similar in form to ...
> 
>     [NSUserDefaults standardUserDefaults]
>     [NSNotificationCenter defaultCenter]
> 
> Neither NSApplication, NSUserDefaults nor NSNotificationCenter technically 
> adhere to the Singleton pattern -- although everyone labels this technique as 
> such.
> 
> https://en.wikipedia.org/wiki/Singleton_pattern

Yeah, but are the "effectively singletons"?
> 
> Alex, the API uses lots of different words to grab a-hold of the so-called 
> "standard", "default" or "shared" static instance. Unfortunately, I'm not 
> aware of any docs that specify when to use which adjective or if any one 
> particular adjective should be used when creating a real Singleton ... since 
> none of these are!

I just remember looking into Apple's implemented conventions on this last week 
in iOS and didn't have time to fully look this up.  It's just what I noticed 
they were doing in a few areas that escape me at the moment.  

Except for the application delegate, which does use sharedApplication as its 
accessor.

Cheers.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to