Re: Newbie: Proper objc style
Re: Newbie: Proper objc style
- Subject: Re: Newbie: Proper objc style
- From: mmalcolm crawford <email@hidden>
- Date: Sun, 9 May 2004 19:37:23 -0700
On May 9, 2004, at 6:29 PM, Jorge Martins wrote:
1 - Is it good style to have a class return autoreleased instances of
NSMutableArray? Should such a method be called -arrayOfWhatever?
Kind of like a convenience constructor but in another class?
Perhaps more likely to be named something akin to
"objects{For,With}..." and return an NSArray, e.g.
<
http://developer.apple.com/documentation/LegacyTechnologies/
WebObjects/WebObjects_4.5/System/Library/Frameworks/EOAccess.framework/
ObjC_classic/Classes/EOEditingContextAdditions.html#//apple_ref/occ/
instm/EOEditingContext Additions/objectsForEntityNamed:>
2 - If my class methods depend on instance variables being nil or some
pointer to determine correct behavior, should I initialize those
variables to nil in +alloc or -init?
What if a user of my class doesn't call -init? They have to call
+alloc no matter what.
<
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/
Tasks/AllocInitObjects.html>
There should be a book on objective-c "good practices". Something like
"Effective Objective-C."
<
http://developer.apple.com/documentation/Cocoa/Conceptual/
CodingGuidelines/Articles/NamingBasics.html>
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.