Linked Questions
10 questions linked to/from Are there guidelines on how many parameters a function should accept?
3
votes
6
answers
9k
views
Setters or constructor for many variables? [duplicate]
Possible Duplicate:
Are there guidelines on how many parameters a function should accept?
I have got class with 30 variables (it is an application form), so I wonder what is the best practice to ...
3
votes
0
answers
533
views
Function that has too many parameters [duplicate]
I'm a junior developer learning programming in Python. I found that some of functions I write uses too many parameter, like
def f(a,b,c,d,e,g,h):
What would one recommend to avoid such a situations? ...
-1
votes
1
answer
166
views
Is it common to have a constructor with 7 elements for example? [duplicate]
Is it common to have a constructor with 7 elements for example? or is it better to use many setters instead?
23
votes
6
answers
10k
views
Is readability a valid reason to not use const in (reference) parameters?
When writing some functions, I found a const keyword in parameters like this:
void MyClass::myFunction(const MyObject& obj,const string& s1,const string& s2,const string& s3){
}
...
16
votes
4
answers
6k
views
Single method with many parameters vs many methods that must be called in order
I have some raw data I need to do many things to (shift it, rotate it, scale it along certain axis, rotate it to a final position) and I am not sure what the best way to do this to maintain code ...
16
votes
4
answers
12k
views
Techniques for minimising number of function arguments
In Clean Code, it is written that "the ideal number of arguments for a function is zero". The reasons why are explained and make sense. What I'm after is techniques to refactor methods with 4 or more ...
9
votes
2
answers
3k
views
Is "too many parameters" a visual or a logical issue?
according to Are there guidelines on how many parameters a function should accept?, a method should not have too many parameters. However, some answers suggest this issue can be solved by builder ...
5
votes
2
answers
609
views
Function that requires many parameters
I have a problem related to this:
Are there guidelines on how many parameters a function should accept?
In my case, I have a function that describes a rounded rectangle. The caller specifies
An ...
2
votes
4
answers
291
views
Options for constructing an object that is not logically initialized until all fields are set
I am working on a Pokemon game at the moment, and am running into some design concerns. The easiest example is as follows:
Each Species of Pokemon has several traits that are required before it is ...
0
votes
2
answers
98
views
Inside a non-static non-virtual method, if it just use a few non-static members, should I turn it into static methods with parameters?
According to Are there guidelines on how many parameters a function should accept?, it is ok for a method to have few parameters.
According to https://stackoverflow.com/questions/11240178/what-is-...