Re: [ANN] Cocoa Style for ObjC: 1 and 2
Re: [ANN] Cocoa Style for ObjC: 1 and 2
- Subject: Re: [ANN] Cocoa Style for ObjC: 1 and 2
- From: Ken Ferry <email@hidden>
- Date: Wed, 27 Oct 2004 20:52:19 -0400
On Wed, 27 Oct 2004 16:12:55 -0700, Scott Stevenson
<email@hidden> wrote:
>
>
On Oct 27, 2004, at 2:13 PM, Ken Ferry wrote:
>
>
> Does not saying
>
> [NSFontManager sharedFontManager]
>
> feel like you're repeating yourself?
>
>
To some degree, but I think the point is that the method should always
>
describe what's being returned. One of the points that the tutorial
>
makes is that Cocoa sacrifices brevity for clarity.
I agree that's a tradeoff that cocoa often makes, but I think they got
it wrong here. It's a polymorphism thing. Sending a "sharedInstance"
message to a class object makes sense and does the same thing with any
singleton class. Do we say [string copyString]? [array copyArray]?
No.
Also, it's perfectly clear what -[Class sharedInstance] does, so we
don't gain clarity by making the return type part of the message name.
>
> In my own code I always use +[Class sharedInstance]
>
>
To me saying "instance" more even more redundant. :)
That's quite debatable. :-) I use sharedInstance because I think it
reads well, but another message name might be better.
-Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden