• 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: Objective-C default arguments??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C default arguments??


  • Subject: Re: Objective-C default arguments??
  • From: Wade Tregaskis <email@hidden>
  • Date: Sat, 1 Nov 2003 18:54:39 +1100

I'd argue that it's better to only have the one method, and simply make sure your method handles nil arguments appropriately. There are a few reasons for this:

a) It saves coding
b) It keeps your class small and simple
c) It makes users of your class think about all the arguments, rather than jumping for the bare minimum
d) It makes default values for non-objects (e.g. boolean values) explicit to the class user, rather than hiding them
e) It's the only way to handle methods with more than a couple of arguments, at which point trying to handle every possible combination often becomes ridiculous

Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Objective-C default arguments?? (From: Malcolm Sharman <email@hidden>)

  • Prev by Date: Re: Objective-C default arguments??
  • Next by Date: Property list invalid for format
  • Previous by thread: Re: Objective-C default arguments??
  • Next by thread: Re: Objective-C default arguments??
  • Index(es):
    • Date
    • Thread