Click here to Skip to main content
15,918,049 members

Survey Results

Are optional parameters for methods good or bad?   [Edit]

Survey period: 28 Feb 2005 to 6 Mar 2005

C++ has them, C# doesn't. Overall, what's your preference?

OptionVotes% 
Good84865.48
Bad28722.16
Undecided16012.36



 
GeneralRe: Overload nitemare Pin
Chris Meech28-Feb-05 1:46
Chris Meech28-Feb-05 1:46 
GeneralRe: Overload nitemare Pin
Blake Miller28-Feb-05 5:13
Blake Miller28-Feb-05 5:13 
GeneralRe: Overload nitemare Pin
BluePineNeedles28-Feb-05 12:19
BluePineNeedles28-Feb-05 12:19 
GeneralRe: Overload nitemare Pin
Jason De Arte28-Feb-05 14:24
Jason De Arte28-Feb-05 14:24 
GeneralRe: Overload nitemare Pin
John M. Drescher3-Mar-05 6:10
John M. Drescher3-Mar-05 6:10 
GeneralRe: Overload nitemare Pin
Phil Harding28-Feb-05 3:59
Phil Harding28-Feb-05 3:59 
GeneralRe: Overload nitemare Pin
Grimolfr28-Feb-05 4:20
Grimolfr28-Feb-05 4:20 
GeneralRe: Overload nitemare Pin
jmueller28-Feb-05 8:59
jmueller28-Feb-05 8:59 
Another problem with optional parameters has to do with changing the default value.

If I compile against a method with an optional parameter, and I leave out the optional parameter, my code is actually compiled with the current default value of the optional parameter explicitly built into my binary. If a new version of the library I'm using comes out, and this new version has a different default value for the optional parameter, my code will continue to send the old default value unless I recompile it against the new version of the library.

However, if the library is done with overloaded methods instead of optional parameters, then whatever default value the library elects to use when I leave off a parameter, that default value is internal to that library, and not compiled into my client code the way it is with optional parameters. So new versions of that library can come out with different default values, and it won't break my code or force me to recompile it.

Joel
GeneralRe: Overload nitemare Pin
Nemanja Trifunovic1-Mar-05 6:15
Nemanja Trifunovic1-Mar-05 6:15 
GeneralRe: Overload nitemare Pin
SHaroz2-Mar-05 13:02
SHaroz2-Mar-05 13:02 
GeneralRe: Overload nitemare Pin
Anonymous2-Mar-05 22:58
Anonymous2-Mar-05 22:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.