• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [ANN] Cocoa Style for ObjC: 1 and 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >[ANN] Cocoa Style for ObjC: 1 and 2 (From: Scott Stevenson <email@hidden>)
 >Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Scott Stevenson <email@hidden>)
 >Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Ken Ferry <email@hidden>)
 >Re: [ANN] Cocoa Style for ObjC: 1 and 2 (From: Scott Stevenson <email@hidden>)

  • Prev by Date: [NEWBIE] How to send an email with Cocoa?
  • Next by Date: Re: [NEWBIE] How to send an email with Cocoa?
  • Previous by thread: Re: [ANN] Cocoa Style for ObjC: 1 and 2
  • Next by thread: Re: [ANN] Cocoa Style for ObjC: 1 and 2
  • Index(es):
    • Date
    • Thread