-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathCNumberOfParameters.qhelp
More file actions
32 lines (25 loc) · 1.32 KB
/
CNumberOfParameters.qhelp
File metadata and controls
32 lines (25 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the number of parameters for each method. If a method has a large number of
parameters it becomes difficult to call. It is also an indication that the method may be trying to
do too much.</p>
</overview>
<recommendation>
<p>If the parameters of the method are logically related (for example different lines of an
address) it may be best to create a new class to contain them, create an instance of that class and
pass the class to the method.</p>
<p>If the method only uses a parameter in a short part of its code then possibly this section
should be split off into another method.</p>
<p>Another possibility is that the parameters are not actually used at all. They may have been added when the method
was first written and then it was discovered they were not needed but they were not removed from the method signature.
In these cases it should be reasonably easy to remove the parameter and refactor calls to the method appropriately.</p>
<p>If the method is part of a public interface it may be difficult to modify the signature so it is important to design
interfaces correctly the first time.</p>
</recommendation>
<references>
<li>Martin Fowler. <em>Refactoring</em>. Addison-Wesley. 1999.</li>
</references>
</qhelp>