Re: Amount of Arguments per Method
Re: Amount of Arguments per Method
- Subject: Re: Amount of Arguments per Method
- From: Graham Cox <email@hidden>
- Date: Tue, 23 Jun 2009 01:19:26 +1000
On 23/06/2009, at 1:03 AM, WT wrote:
This brings to mind a peeve of mine: Apple's unofficially sanctioned
practice, followed by a lot of people, of NOT throwing in some white
space in between parts of method names. Programmers spend most of
their time *reading* code (their own or other people's), and with
method names as verbose as those found in Cocoa, it seems to me that
adding some white space ought to be a common practice. Alas...
I mean, seriously, how easy is it to read
I totally agree with you.
On a very similar note, I really dislike the fact that in headers (and
source for that matter), the return type of a method is immediately
followed by the start of the method name. It makes it very hard to
visually separate the two and hence very easy to miss a method
relevant to a given problem when hunting through the headers. In my
own headers, I put whitespace between the return type and the start of
the method name, and also line up the method names on a tab. It makes
manually 'parsing' headers far easier, since I'm usually more
interested in what the method does than the type it returns, at least
on a first pass.
e.g:
- (BOOL) shouldAutoActivateWithEvent:(NSEvent*) event;
- (BOOL) hitLayer:(NSPoint) p;
- (DKDrawableObject*) hitTest:(NSPoint) p;
- (void) mouseDown:(NSEvent*) event inView:(NSView*) view;
- (void) mouseDragged:(NSEvent*) event inView:(NSView*) view;
- (void) mouseUp:(NSEvent*) event inView:(NSView*) view;
- (void) flagsChanged:(NSEvent*) event;
- (NSView*) currentView;
- (NSCursor*) cursor;
- (NSRect) activeCursorRect;
as opposed to:
- (BOOL)shouldAutoActivateWithEvent:(NSEvent*)event;
- (BOOL)hitLayer:(NSPoint)p;
- (DKDrawableObject*)hitTest:(NSPoint)p;
- (void)mouseDown:(NSEvent*) event inView:(NSView*)view;
- (void)mouseDragged:(NSEvent*)event inView:(NSView*)view;
- (void)mouseUp:(NSEvent*) event inView:(NSView*)view;
- (void)flagsChanged:(NSEvent*)event;
- (NSView*)currentView;
- (NSCursor*)cursor;
- (NSRect)activeCursorRect;
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden