Newbie: Proper objc style
Newbie: Proper objc style
- Subject: Newbie: Proper objc style
- From: Jorge Martins <email@hidden>
- Date: Sun, 9 May 2004 21:29:51 -0400
Hi!
This is not specific to Cocoa. It's about generic Objective-C style.
Even after reading a couple of books and looking at as much source code
as I could, I have a couple of questions on proper objc style.
I'm writing a light wrapper for the PostsreSQL C functions in objc, and
I intend to use it in Cocoa applications.
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?
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.
Are these normal questions that newbie objective-c people ask
themselves or am I overthinking here?
My stuff works, but I am not sure if I'm writing idiomatic objc.
There should be a book on objective-c "good practices". Something like
"Effective Objective-C."
Thank you for your time.
--
Jorge Martins
email@hidden
_______________________________________________
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.