Click here to Skip to main content
15,913,944 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Colborne_Greg19-May-14 8:42
Colborne_Greg19-May-14 8:42 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Pete O'Hanlon19-May-14 8:56
mvePete O'Hanlon19-May-14 8:56 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Colborne_Greg19-May-14 9:04
Colborne_Greg19-May-14 9:04 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Pete O'Hanlon19-May-14 9:11
mvePete O'Hanlon19-May-14 9:11 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Colborne_Greg19-May-14 9:55
Colborne_Greg19-May-14 9:55 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Colborne_Greg19-May-14 8:51
Colborne_Greg19-May-14 8:51 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
PIEBALDconsult18-May-14 18:12
mvePIEBALDconsult18-May-14 18:12 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? PinPopular
_Maxxx_18-May-14 19:02
professional_Maxxx_18-May-14 19:02 
I think I have some internal, arbitrary rule that says;

If the parameters are basically unrelated except for being passed to that function, then leave them as individual arguments, well defined by their names.

If the parameters are related, then wrap them in some structure or other.

In other words, I wouldn't wrap parameters in a class or struct just to make the function signature smaller or more legible, but I would do so if it made sense for the parameters to be combined;

The danger of wrapping them is that you replace a long function call with a complex struct creation, to no real advantage - reading a method signature with meaningful argument names is self-documentation; the same method with a single argument called "necessaryInfoToDoTheJob is less descriptive!
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Jörgen Andersson18-May-14 20:30
professionalJörgen Andersson18-May-14 20:30 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
CPallini18-May-14 21:43
mveCPallini18-May-14 21:43 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
kalberts18-May-14 22:33
kalberts18-May-14 22:33 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
BobJanova19-May-14 1:13
BobJanova19-May-14 1:13 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Tony Moffatt19-May-14 1:36
Tony Moffatt19-May-14 1:36 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
BobJanova19-May-14 6:58
BobJanova19-May-14 6:58 
JokeRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
Kirk 1038982119-May-14 3:51
Kirk 1038982119-May-14 3:51 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
patbob19-May-14 5:57
patbob19-May-14 5:57 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
RafagaX19-May-14 9:35
professionalRafagaX19-May-14 9:35 
GeneralRe: Best Practice Question - How do you prefer to pass a bunch of options to a function? Pin
User 483504720-May-14 3:51
User 483504720-May-14 3:51 
GeneralElectronaggedon Pin
#realJSOP18-May-14 4:44
professional#realJSOP18-May-14 4:44 
GeneralRe: Electronaggedon Pin
Duncan Edwards Jones18-May-14 5:19
professionalDuncan Edwards Jones18-May-14 5:19 
GeneralRe: Electronaggedon PinPopular
Paul M Watt18-May-14 6:17
mentorPaul M Watt18-May-14 6:17 
GeneralRe: Electronaggedon Pin
Rage18-May-14 22:25
professionalRage18-May-14 22:25 
GeneralRe: Electronaggedon Pin
AlphaDeltaTheta18-May-14 6:53
AlphaDeltaTheta18-May-14 6:53 
GeneralRe: Electronaggedon Pin
#realJSOP18-May-14 7:45
professional#realJSOP18-May-14 7:45 
GeneralRe: Electronaggedon Pin
Duncan Edwards Jones18-May-14 8:11
professionalDuncan Edwards Jones18-May-14 8:11 

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.