-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 6/1/11 11:45 PM, Bing Li wrote: > Dear all, > > I have a question on delegate/notification techniques in Cocoa.
Roland and Jens have already addressed your main issue (you can also look at my response to Dan Hopwood a few days ago on a related issue). But additionally you really should try to adhere to Cocoa coding conventions (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html). In particular you want to avoid starting method names with capital letters (unless they begin with a permitted abbreviation or acronym, such as is the case with, e.g., many NSURL methods). Also, while not explicitly addressed in Apple's guidelines (AFAICT), Google's Objective-C style guide (http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml) directs that spaces in method declarations be minimized. For example: - - (void) setUpNotification: (NSString *) notification withSelector: (SEL) methodName would be rewritten: - - (void)setUpNotification:(NSString *)notification withSelector:(SEL)methodName This makes it moderately easier to discern what the actual method arguments (and their types) are. While one could certainly say that Google's guidelines are "unofficial" with respect to this issue, they comport with Apple's own header style and I believe can be treated as authoritative in this case. Not only will following the guidelines now make it easier to share code and design APIs for use by others in the future, but it will probably make debugging easier (if for no other reason than people on this list will have to spend a couple fewer mental run loop cycles decoding what you intended). Just some friendly advice from someone who not that long ago was new to Objective-C and Cocoa and had to go through the same growing pains. - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk3nRyEACgkQaOlrz5+0JdXN9ACdHqlhS6EHBCB3sEWpVo/y5WTp 2ZMAnjQTxZi7T+c1PytprpdxbUb4Mwf5 =Mism -----END PGP SIGNATURE----- _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
