• 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: Turn off duplicate method warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turn off duplicate method warning


  • Subject: Re: Turn off duplicate method warning
  • From: Uli Kusterer <email@hidden>
  • Date: Sat, 22 Jul 2006 19:46:51 +0200


Am 21.07.2006 um 14:09 schrieb Trygve Inda:

I have two methods:

-(void)generate:(NSMutableDictionary *)dict

This is in my main AppController (and in AppController.h), and it calls

-(QTMovie *)generate:(NSMutableDictionary *)dict

This might be a good choice to consider the naming of your methods. If you have a method name that works just fine for several different return types, it should either return a more generic type (e.g. "id"), or it should have a more specific name. If you have control over both classes, I'd suggest renaming the second to


-generateMovieFromInfoDictionary:

(Instead of InfoDictionary you may want to use some more suitable name based on what your app actually does and what the dictionary contains). I'd also suggest a name that contains more information about what kind of a dictionary it takes for the first method, but I can't make any useful guesses from what little information you provided.

Objective C lends itself to writing self-documenting code, Xcode's autocompletion makes it easy to type those long names. Take advantage of that and you'll automatically avoid the naming conflict and your code will be easier to maintain because you won't have to look up what kind of a dictionary this method expects when you come back to it a year later.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de


_______________________________________________ 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: 
 >Turn off duplicate method warning (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Writing application without Interface Builder
  • Next by Date: Re: Finding out if an NSArray's contents are all equal
  • Previous by thread: Re: Turn off duplicate method warning
  • Next by thread: How to "clear" First Responder?
  • Index(es):
    • Date
    • Thread