Re: Why so many public properties all up in my grizzle?
Re: Why so many public properties all up in my grizzle?
- Subject: Re: Why so many public properties all up in my grizzle?
- From: Charles Srstka <email@hidden>
- Date: Sat, 17 Mar 2012 03:17:00 -0500
On Mar 16, 2012, at 9:16 PM, G S wrote:
> Thanks for asking this, Brian. I've wondered the same thing, and in fact I
> went through my code and removed almost all property declarations from my
> view controllers. Since most properties are declared as "retain", you're
> just increasing your bookkeeping to avoid leaks. Not to mention the sheer
> maintenance hassle of typing out or deleting the declarations as you add or
> remove members.
>
> And as someone pointed out, properties are not at all necessary for making
> connections in IB. So I don't see the point. Now I'm referring to the
> members directly, with the added bonus of being able to use member notation
> to identify members for clarity.
This pattern is pretty questionable though in terms of OO — you have one class (NSNib, UINib, etc.) directly setting instance variables in another class (your view controller) and using runtime functions to hack around things like @private. That’s really icky — using properties seems like a much cleaner way to do it. The property can be declared in a class extension in the .m file, and it’s not like typing
@property IBOutlet NSButton *foo;
is that much harder than typing
{
@private
IBOutlet NSButton *_foo;
}
when it comes down to it.
Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden