site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com On 31 Mar, 2005, at 1:19 PM, Adam wrote: Is it better to be more clear like and break things down: One thing to watch out for with the second example is something like -John _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... What is considered good cocoa style? I am sometimes tempted to be efficient and code like: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendCommandToSocket:) name:@"AGFIBSSendCommandToSocket" object:nil]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(sendCommandToSocket:) name:@"AGFIBSSendCommandToSocket" object:nil]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(sendCommandToSocket:) name:@"AGFIBSSendCommandToSocket" object:nil]; ... [nc addObserver:self selector:@selector(appLaunched:) name:NSWorkspaceDidLaunchApplicationNotification object:nil]; You'll never receive the second notification, since NSWorkspace uses its own notification center, not the default one. This email sent to site_archiver@lists.apple.com