-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathCNumberOfFields.qhelp
More file actions
53 lines (42 loc) · 1.15 KB
/
CNumberOfFields.qhelp
File metadata and controls
53 lines (42 loc) · 1.15 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>
This metric measures the number of fields in classes below this
location in the tree. At a class level, it just measures the number of
fields in the class itself.
</p>
<p>
There are at least a couple of reasons why a class may have too many fields:
</p>
<ul>
<li>The class in general may be too big / have too many responsibilities.</li>
<li>Several of the fields may be part of the same abstraction.</li>
</ul>
</overview>
<recommendation>
<p>
The best resolution depends on the underlying reason behind it:
</p>
<ul>
<li>
If the class is too big, it should be split into multiple smaller classes.
</li>
<li>
If several of the fields are part of the same abstraction, they should be
grouped into a separate class, using the 'Extract Class' refactoring described
in [Fowler].
</li>
</ul>
</recommendation>
<references>
<li>
M. Fowler. <em>Refactoring</em> pp. 65, 122-5. Addison-Wesley, 1999.
</li>
<li>
R. Martin. <a href="https://drive.google.com/file/d/0ByOwmqah_nuGNHEtcU5OekdDMkk/view">The Single Responsibility Principle</a>. Published online.
</li>
</references>
</qhelp>