Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing best practice



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Subclassing best practice (From: John Stiles <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.