Re: NSURLConnection unhappiness
Re: NSURLConnection unhappiness
- Subject: Re: NSURLConnection unhappiness
- From: Jeff Johnson <email@hidden>
- Date: Mon, 4 May 2009 13:42:36 -0500
Yes, those result in a message call, though it's a very fast message
call. Within your instance methods, however, you can just access the
ivar directly, e.g, "connection" without a message call and without
"self->connection".
-Jeff
On May 1, 2009, at 11:00 AM, Nick Hristov wrote:
Thank you all for your suggestions. I will use the runloop to wait on
response.
One more comment on self->ivar... I used this approach because using
[self
connection] or self.connection (they are both the same thing) amount
to an
extra message call.
Nick
On Thu, Apr 30, 2009 at 11:09 AM, Jeff Johnson <
email@hidden> wrote:
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