• 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: NSObject Exercise comments?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObject Exercise comments?


  • Subject: Re: NSObject Exercise comments?
  • From: glenn andreas <email@hidden>
  • Date: Mon, 12 Dec 2005 13:54:15 -0600


On Dec 12, 2005, at 1:04 PM, John Stiles wrote:

On Dec 10, 2005, at 10:39 AM, Andreas Mayer wrote:

> > -(Fraction *) reduceFraction

However, it is a good point because it leads to unnecessary confusion.

That's actually the main point, I think. When I see a method that returns an object, that object is usually a new one.

I know that there was a convention were the original object was returned when ever possible, so that one could 'chain' method calls together. But I think this is discouraged now. At least it's uncommon and therefore confusing.

Is that so? I thought that was one of the coolest points of Cocoa, honestly. You certainly still see it throughout Apple's classes.

About the only methods that "return self" are init (because they need to return something - and sometimes something other than self) and "autorelease".

Method chaining gets real confusing real quick because there's no clear difference between something that is using it to perform a series of operations and something that uses something that syntactically is identical but in fact is performing different operation on different objects.



Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • RE: NSObject Exercise comments?
      • From: "Frode" <email@hidden>
References: 
 >Re: NSObject Exercise comments? (From: Lee Cullens <email@hidden>)
 >Re: NSObject Exercise comments? (From: Andreas Mayer <email@hidden>)
 >Re: NSObject Exercise comments? (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Cocoa and REALbasic communication?
  • Next by Date: Re: Core Data: NSArrayController's MOC vs NSPersistentDocument's MOC
  • Previous by thread: Re: NSObject Exercise comments?
  • Next by thread: RE: NSObject Exercise comments?
  • Index(es):
    • Date
    • Thread