Group method parameter or individual parameter?

Posted by Nassign on Programmers See other posts from Programmers or by Nassign
Published on 2012-04-09T10:40:46Z Indexed on 2012/04/09 11:47 UTC
Read the original article Hit count: 249

Filed under:
|

I would like to ask on method parameters design consideration. I am usually deciding between using individual variables as parameters versus grouping them to a class or dictionary as one parameter.

Is there such a rule when you should use individual parameter against using a class or a dictionary to group the parameter?

Individual parameter - Straight forward, strongly typed

Dictionary parameter - Very extensible, like HTTP request but cannot be strongly typed.

Class parameter - Extensible by adding member to the class parameter, strongly typed.

I am looking for a design reference on when to use which?

Note: I am not sure if this question is valid in programmers but I definitely think it would be closed in stackoverflow, If it is still not valid, please point me to the proper page.

© Programmers or respective owner

Related posts about design

Related posts about methods