Click here to Skip to main content
15,920,675 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
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 
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 
I personal perfer overloading for one reason only.

1) It requires the user of the method to always pass in the required values to make the method work properly.

By this I mean that often when you Change one parameter from the default you are required (logically) to often change another parameter.

With overloading this behaviour is enforce by the compiler, ie.e if I want to change that parameter I have to change the other. Where as optional parameters require me to read the doco to find out any inter-relationships between the parameters.

Then again, the majority of time I have seen overloading jsut creating more code...

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.