• 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: Lee Cullens <email@hidden>
  • Date: Mon, 12 Dec 2005 22:24:36 -0500

This is about more "generic" method names in Cocoa (not the return point Ondra explained, or the id point Andreas made). Before I move on to Cocoa in depth I decided to also study Apple's ObjC.pdf and ObjCRuntimeRef.pdf to further reinforce my familiarity.

One thing that has struck me is a selective (unscientific and possibly misguided observation) use of "generic" method names where polymorphism might otherwise be employed (of course I don't have enough knowledge to gage just how selective or even gage differentiation).

When Andreas mentioned that I might name my arithmetic methods "similar" to those of NSDecimalNumber, I wondered why not "the same as" like arithmetic methods used "many" other places. In other words, instead of:

decimalNumberByAdding:
LCFractionByAdding:
XXComplexNumberByAdding
...

just always use something like -(id) byAdding: (id) aWhatever;

and yes, the receiver would be more involved in at least ensuring aWhatever is the same type of object, or more so in possibly dealing with a practical range of aWhatever types.

Now, I'm not saying there *is* a "standards" selectivity mindset (don't know enough to argue the point), but rather am throwing this out in the hope of gleaning more insight into community methodologies :-)

Actually, I taking a real liking to ObjC because of its' simplicity and Cocoa is probably much better than it would have been had it been based on something else. I've never had a real need for such as operator overloading and metaclasses :-(

Hope I'm not wasting your time with a dumb thought, Lee C
"The early bird may get the worm but the second mouse gets the cheese." -- Willie Nelson


_______________________________________________
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: Andreas Mayer <email@hidden>
  • Prev by Date: Re: Dynamically loading my code into other apps
  • Next by Date: Re: "Detaching" a managed object.
  • Previous by thread: RE: NSObject Exercise comments?
  • Next by thread: Re: NSObject Exercise comments?
  • Index(es):
    • Date
    • Thread