site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com On Mar 31, 2005, at 12:32 PM, John C. Randolph wrote: On Mar 31, 2005, at 10:19 AM, Adam wrote: Is it better to be more clear like and break things down: -jcr John C. Randolph <jcr@apple.com> (408) 974-8819 Sr. Cocoa Software Engineer, Apple Worldwide Developer Relations http://developer.apple.com/cocoa/index.html [ [NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendCommandToSocket:) name:@"AGFIBSSendCommandToSocket" object:nil ] ; Haris _______________________________________________ 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]; It's really just a matter of taste. I often write code in the more verbose manner, and then condense it after I've gotten it working. I find more verbose code also easier to debug. You can easily query if the intermediate steps are nil or whatnot. Of course, in this particular case, it wouldn't make a much difference. On Mar 31, 2005, at 12:28 PM, Mike R. Manzano wrote: I like this, very clear. This email sent to site_archiver@lists.apple.com
participants (1)
-
Charilaos Skiadas