• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why so many public properties all up in my grizzle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Why so many public properties all up in my grizzle?
      • From: G S <email@hidden>
References: 
 >Why so many public properties all up in my grizzle? (From: Brian Lambert <email@hidden>)
 >Re: Why so many public properties all up in my grizzle? (From: G S <email@hidden>)

  • Prev by Date: Re: Transition from [NSEvent phase] to [NSEvent momentumPhase]
  • Next by Date: Re: The use of UIActionSheet mysteriously disables our app with a white screen after memory warning.
  • Previous by thread: Re: Why so many public properties all up in my grizzle?
  • Next by thread: Re: Why so many public properties all up in my grizzle?
  • Index(es):
    • Date
    • Thread