Re: Window Styles
Re: Window Styles
- Subject: Re: Window Styles
- From: Ondra Cada <email@hidden>
- Date: Sat, 15 May 2004 18:33:54 +0200
Rob,
On 15.5.2004, at 17:03, j o a r wrote:
>
> Why should you usually avoid subclassing? Do you mean in Cocoa or
>
> AppKit? If so, why?
>
>
Developers coming to Cocoa from other OOP environments (Java, C++) are
>
often accustomed to rely heavily on subclassing. Cocoa is designed in a
>
different way, where categories (a language feature of ObjC) and
>
delegates (a very effective design pattern) often makes it unnecessary
>
to subclass most specialized classes in Cocoa.
>
I'm not saying that you should never subclass, but you should look for
>
alternatives before you do. I't often easier and more flexible not to.
Amen to that.
And, (again of course not without exceptions, but *very very often*)
subclassing tends to lead to bad MVC patterns, whilst delegation,
object embedding and message forwarding, and similar ObjC/Cocoa
technologies tend to keep MVC clean and transparent.
Therefore, unless you happen to work with a class explicitly designed
for subclassing (like, say, NSDocument or NSView), you should always
consider patterns which do not exploit subclassing first, and resort to
subclassing only if none of them proves to be useable and convenient.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.