• 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: NSURLConnection unhappiness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSURLConnection unhappiness (From: Nick Hristov <email@hidden>)
 >Re: NSURLConnection unhappiness (From: Jeff Johnson <email@hidden>)
 >Re: NSURLConnection unhappiness (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Why is NSString->FSRef so hard?
  • Next by Date: Re: NSTextView append Text help
  • Previous by thread: Re: NSURLConnection unhappiness
  • Next by thread: Re: NSURLConnection unhappiness
  • Index(es):
    • Date
    • Thread