Re: Abstract classes and methods
Re: Abstract classes and methods
- Subject: Re: Abstract classes and methods
- From: "Michael B. Johnson" <email@hidden>
- Date: Thu, 30 Aug 2001 10:24:51 -0700
- Organization: Pixar Animation Studios
Georg Tuparev wrote:
>
>
I too think Michael has spoken too soon. I'm sure he himself never fully
>
implemented all NSWindows or NSApplication delegate methods. But there
>
are many places where formal protocols are a necessity. Every time an
>
object should behave like a good citizen in the community of domain
>
related objects protocols work best. Another classical example are
>
remote objects in distributed systems...
>
Two points, I guess:
I usually *do* implement all of the delegate methods, usually because I want to see what's possible,
although most of them are implemented with the default return value as documented (i.e. lots of
methods that just return YES or NO). This lets me look at my class if I need to control something
later on and just add some more logic to it. I realize that I'm probably pretty lonely in doing
this :-)
I'm not advocating that most people say that their class strictly conforms to a given informal
protocol. Rather, I'm saying that it would be nice to know, when it makes sense (i.e. most delegate
informal protocols are a handful, and tend to cluster in one or two ways), to have the class
designer make these informal protocols formal, so that *those that want to* (and on a private poll,
several people have told me that they would like this as well) can say that their delegate class
conforms to that protocol, so that they can leverage the compiler.
Again, I'm not saying that the implementor of the delegate class *has* to fully conform to the
protocol; they can implement as few methods as they want.
This seems like a win/win situation; especially for programmers who are less experienced with the
given (informal) protocols.
And yes, I know, I can declare the protocol myself and then conform to it, but I'm saying that I
would like it if the class designers themselves did it - that would be nicer...
I'll shut up now (at least on this topic).
--> Michael B. Johnson, Ph.D. -- email@hidden
--> Studio Tools, Pixar Animation Studios
-->
http://xenia.media.mit.edu/~wave