Click here to Skip to main content
15,918,168 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
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 
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 
Phil Harding wrote:
2. They allow for optional behaviour of a method
3. They accomodate refactoring
4. They accomodate code reuse and enhancements without breaking an existing code base


So does simple method overloading. None of these is really a valid argument in the whole optionalParameter vs. overloadedMethod debate, which seems to be where this discussion is headed.

Personally, I prefer overloading. With overloading, there's never any doubt as to whether the calling method didn't specify the parameter, or just happened to specify the "default" value for the parameter. Sometimes the distinction matters.


Grim
(aka Toby)
MCDBA, MCSD, MCP+SB


SELECT * FROM users WHERE clue IS NOT NULL
GO
(0 row(s) affected)

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 

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.