Click here to Skip to main content
15,896,915 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



 
GeneralA proposal that (I think) would make everyone happy Pin
Don Clugston6-Mar-05 15:51
Don Clugston6-Mar-05 15:51 
Looking at the arguments on both sides, it looks to me as though conflict resolution is possible. I believe there is a win-win situation:

Make optional parameters a syntactical shortcut for overloading.

ie,

int dosomething(int a, string b, float c=1.2);

should be a shorthand for:

int dosomething(int a, string b, float c);
inline int dosomething(int a, string b) {
dosomething(a, b, 1.2);
}

Then I think all complaints on both sides evaporate.
- convenient syntax
- allows easy changes to an existing framework
- something that looks like a call to 'dosomething(int, string)' actually IS a call to dosomething(int, string), not a call to some secret function with peekaboo parameters.

Is anyone still unhappy with this suggestion?
GeneralRe: A proposal that (I think) would make everyone happy Pin
Michael Flanakin10-Mar-05 11:25
Michael Flanakin10-Mar-05 11:25 
GeneralDepends on the language... Pin
Jeremy Falcon6-Mar-05 4:55
professionalJeremy Falcon6-Mar-05 4:55 
GeneralThere should be no parararmeters Pin
Anonymous3-Mar-05 18:00
Anonymous3-Mar-05 18:00 
GeneralDefaults promote bad design Pin
Peter Ritchie3-Mar-05 15:35
Peter Ritchie3-Mar-05 15:35 
GeneralNone is best! Pin
Bob Stanneveld28-Feb-05 20:39
Bob Stanneveld28-Feb-05 20:39 
GeneralRe: None is best! Pin
netclectic28-Feb-05 23:38
netclectic28-Feb-05 23:38 
GeneralRe: None is best! Pin
Nemanja Trifunovic1-Mar-05 2:56
Nemanja Trifunovic1-Mar-05 2:56 
GeneralRe: None is best! Pin
tom_dx1-Mar-05 1:58
tom_dx1-Mar-05 1:58 
GeneralRe: None is best! Pin
Bob Stanneveld1-Mar-05 3:29
Bob Stanneveld1-Mar-05 3:29 
GeneralRe: None is best! Pin
Anonymous3-Mar-05 14:09
Anonymous3-Mar-05 14:09 
GeneralRe: None is best! Pin
tom_dx3-Mar-05 14:10
tom_dx3-Mar-05 14:10 
Generalpowerful feature Pin
Member 129322928-Feb-05 19:20
Member 129322928-Feb-05 19:20 
GeneralAn alternative! Pin
Eddie de Bear28-Feb-05 17:11
Eddie de Bear28-Feb-05 17:11 
GeneralRe: An alternative! Pin
Bob Stanneveld28-Feb-05 20:30
Bob Stanneveld28-Feb-05 20:30 
GeneralI hate them. They foul up generic code. Pin
Don Clugston28-Feb-05 13:40
Don Clugston28-Feb-05 13:40 
GeneralDepends Pin
Giancarlo Aguilera28-Feb-05 9:17
Giancarlo Aguilera28-Feb-05 9:17 
GeneralMissing classes in the model Pin
Daniel Turini28-Feb-05 8:17
Daniel Turini28-Feb-05 8:17 
GeneralOverload nitemare Pin
leppie27-Feb-05 19:57
leppie27-Feb-05 19:57 
GeneralRe: Overload nitemare Pin
WillemM27-Feb-05 20:01
WillemM27-Feb-05 20:01 
GeneralRe: Overload nitemare Pin
Corneliu Tusnea27-Feb-05 22:07
Corneliu Tusnea27-Feb-05 22:07 
GeneralRe: Overload nitemare Pin
WoR27-Feb-05 23:36
WoR27-Feb-05 23:36 
GeneralRe: Overload nitemare Pin
paulccc28-Feb-05 0:59
paulccc28-Feb-05 0:59 
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 

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.