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: [OT] Commenting source code (was Re: Problems with Controls M anager)



At 14:41 Uhr -0600 27.08.2003, Pietrzak, Bryan wrote:
Instead use

SizeControl(control, ComputeScrollbarWidth(window),
ComputeScrollbarHeight(window));


SInt32 ComputeScrollbarHeight(WindowRef window)
{
// whatever
}

SInt32 ComputeScrollbarWidth(WindowRef window)
{
// whatever
}

You know, I'd expect both of this methods to return the width/height of a scrollbar, not the width/height of the content area minus the scrollbar. That's exactly the problem I have with self-documenting code.

ComputeWidthWithoutScrollbar() and ComputeHeightWithoutScrollbar() would be a much better choice. It is *hard* to write self-documenting code, because most programmers are better able to talk about what they're doing at length, than to come up with identifier names that sum up all of this talk in one word.

I admit, I can't offer as much practical experience as others on this list, but I've seen lots of code, and it's full of such "self-documenting code", whose authors actually believe their code *was* readable.

--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



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.