• 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: Window Styles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Window Styles
      • From: Rob Abernathy <email@hidden>
    • Re: Window Styles
      • From: Sherm Pendley <email@hidden>
References: 
 >Re: Window Styles (From: Mark Thomas <email@hidden>)
 >Re: Window Styles (From: Jeremy Dronfield <email@hidden>)
 >Re: Window Styles (From: j o a r <email@hidden>)
 >Re: Window Styles (From: Rob Abernathy <email@hidden>)
 >Re: Window Styles (From: j o a r <email@hidden>)

  • Prev by Date: Re: Window Styles
  • Next by Date: Detect ALT key pressed during dragging
  • Previous by thread: Re: Window Styles
  • Next by thread: Re: Window Styles
  • Index(es):
    • Date
    • Thread