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

Re: Private Methods


  • Subject: Re: Private Methods
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Fri, 22 Feb 2008 14:13:04 +0100


Le 22 févr. 08 à 14:04, Philip Bridson a écrit :

What do you gain by deciding (and forcing) what a user of the code can and cannot do with it?

Is that not the whole reason that @public, @protected and @private are used? To limit what the user has access to?


We write classes that provide a certain functionality to the user of our class. We define what a user can and cannot do with our class. I agree that it is in the best interest of the users not to poke around in our private methods but accidents happen unfortunately and isn't it our job as a developer to protect against such events? Isn't half the code we write put there to fix errors, bugs or to prevent possible errors? We, as developers, should not develop code that has a known error and submit it on the basis that we trust the end user will have the sense not to call the wrong function. Accidents happen.

Phil.

On 22 Feb 2008, at 12:41, João Pavão wrote:


ivar MUST be declared in the public header, so you need a way to restrict access. This is not the case for methods. Declaring a method in the .m file mean this is a private method and used of your class will never see the method declaration.

Give a place where the lack of private method is a problem in the Cocoa framework for example.

_______________________________________________

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: 
 >Private Methods (From: Philip Bridson <email@hidden>)
 >Re: Private Methods (From: Mike Abdullah <email@hidden>)
 >Re: Private Methods (From: Rob Petrovec <email@hidden>)
 >Re: Private Methods (From: Philip Bridson <email@hidden>)
 >Re: Private Methods (From: João Pavão <email@hidden>)
 >Re: Private Methods (From: Philip Bridson <email@hidden>)

  • Prev by Date: Re: Private Methods
  • Next by Date: Re: NSURLConnection failing
  • Previous by thread: Re: Private Methods
  • Next by thread: Re: Private Methods
  • Index(es):
    • Date
    • Thread