Re: NSURLConnection unhappiness
Re: NSURLConnection unhappiness
- Subject: Re: NSURLConnection unhappiness
- From: Jeff Johnson <email@hidden>
- Date: Thu, 30 Apr 2009 13:09:32 -0500
On Apr 30, 2009, at 12:53 AM, Kyle Sluder wrote:
On Thu, Apr 30, 2009 at 1:44 AM, Jeff Johnson
<email@hidden> wrote:
On an unrelated note, your use of "self->connection", etc., is non-
standard
and not advised. You should be using direct ivar access "connection",
properties "self.connection", or accessor methods "[self
connection]".
Sure, `self->connection` is redundant with just plain old
`connection`, but they amount to the same thing. Unless there's some
new-runtime trickery going on that I'm not aware of.
--Kyle Sluder
It amounts to the same thing, but it's a bad habit to get into. It's
redundant, as you say, for an object's own instance variables. And you
shouldn't be trying to directly access the instance variables of other
objects. According to the documentation, "Marking instance variables
@public defeats the ability of an object to hide its data. It runs
counter to a fundamental principle of object-oriented programming—the
encapsulation of data within objects where it’s protected from view
and inadvertent error. Public instance variables should therefore be
avoided except in extraordinary cases." Thus, except in extraordinary
cases, there's no reason to use the "object->ivar" syntax.
-Jeff
_______________________________________________
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