• 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: Subclassing best practice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing best practice


  • Subject: Re: Subclassing best practice
  • From: Uli Kusterer <email@hidden>
  • Date: Wed, 14 Nov 2007 19:34:07 +0100

Am 14.11.2007 um 18:39 schrieb John Stiles:
This works great. However, from a code design perspective, it seems sloppy to me. I don't like having to rely on macros.
In other languages, I could use multiple inheritance, (...) But ObjC doesn't support multiple inheritance.


There are a few cases where I used a Macro, too, but in most cases, stepping back and looking at the code again helped me find a better design that didn't need multiple inheritance:

E.g. often when I was adding members to a basic class like NSWindow, what I really wanted was to have a common base class for my window delegates (i.e. the controller), or to add these members to my model somewhere. Or sometimes, just splitting the controller into several classes helped.

 Sometimes, categories helped, too.

And also, with ObjC 2.0, one can apparently add properties to existing objects somehow. I think this came up on ObjC-Langauge a couple days ago.

Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de




_______________________________________________

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


  • Follow-Ups:
    • Re: Subclassing best practice
      • From: David Spooner <email@hidden>
References: 
 >Subclassing best practice (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Bring app to foreground in 10.5
  • Next by Date: Re: Subclassing best practice
  • Previous by thread: Subclassing best practice
  • Next by thread: Re: Subclassing best practice
  • Index(es):
    • Date
    • Thread