Re: Looking for Cocoa source code
Re: Looking for Cocoa source code
- Subject: Re: Looking for Cocoa source code
- From: Lance Bland <email@hidden>
- Date: Thu, 6 Mar 2003 14:09:54 -0500
On Thursday, March 6, 2003, at 01:15 PM, David Remahl wrote:
>
Apple is keeping the source to themselves, and this is actually good
>
in some cases, since it enforces encapsulation and forces you to rely
>
only on what is documented. The thing is, that the developer should
>
not know exactly what he/she is overriding, since that can change in
>
future implementations of the framework, and then break existing code.
>
>
If you find problems in the documentation, file bugs against it at
>
<http://bugreporter.apple.com>.
That is true to a point, but here is a good example of why it is not
good:
If you write a subclass of NSView and think you need to overload these
methods:
- (void)setFrameOrigin:(NSPoint)newOrigin;
- (void)setFrameSize:(NSSize)newSize;
- (void)setFrame:(NSRect)frameRect;
which one do you overload? all of them?
It might help to know that setFrame: calls setFrameSize: and
setFrameOrigin: to do its job.
Thus you need to overload setFrameSize: and setFrameOrigin: only. And
if you also overload setFrame: then you might be screwed because you
might do some things twice.
It pays to know the implementation details.
-lance
------------------------------------
Lance Bland
mailto:email@hidden
VVI Is The #1 Visual-Report Tool Developer For Mac OS X
http://www.vvi.com
_______________________________________________
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.