Re: Passing References During Initialization / Nib Loading
Re: Passing References During Initialization / Nib Loading
- Subject: Re: Passing References During Initialization / Nib Loading
- From: Michael Ash <email@hidden>
- Date: Fri, 12 Jun 2009 03:27:01 -0400
On Thu, Jun 11, 2009 at 10:10 PM, Quincey
Morris<email@hidden> wrote:
> On Jun 11, 2009, at 18:05, Brad Gibbs wrote:
>
>> Why not just use a singleton [[MainWindowController
>> sharedWindowController] switchToView:[menuItems
>> objectAtIndex:[menuItemsArrayController selectionIndex]] ?
>
> There's nothing wrong with that approach, though it's not perhaps what might
> be understood as a "singleton". You happen to have only a single main window
> controller, and propose having a class method to get it, that's all.
> "Singleton" usually suggests code within the singleton's class to actively
> prevent other instances being created by unruly "client" code. That's not
> necessary here.
It really doesn't. Singleton-ness is a property of the API, not the
implementation. If the API provides a single instance which you use,
then it's a singleton. Enforcing that single instance is entirely up
to the implementation of the API. It's not a necessary feature of a
singleton, and it's not even necessarily a good feature to have.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden