-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathSameNameAsSuper.qhelp
More file actions
29 lines (23 loc) · 1.02 KB
/
SameNameAsSuper.qhelp
File metadata and controls
29 lines (23 loc) · 1.02 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
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This rule identifies a class that has the same name as a class it extends. This is likely to cause confusion.</p>
</overview>
<recommendation>
<p>Change the name of the subclass to make it more clear what its purpose is. It is normally possible to express
how it is different to a superclass.</p>
</recommendation>
<example>
<p>In this example references to ArrayList later on in the Players class could be confusing.</p>
<sample src="SameNameAsSuper.cs" />
</example>
<section title="Fixing by Using a More Descriptive Name">
<p>The example could be easily fixed by changing the <code>Players.ArrayList</code> class name to <code>Players.PlayerList</code>.
This is more descriptive and it avoids confusion with the <code>ArrayList</code> class from <code>Collections</code>.</p>
</section>
<references>
<li>Robert C. Martin, <em>Clean Code - A handbook of agile software craftsmanship</em>, §17.N4. Prentice Hall, 2008.</li>
</references>
</qhelp>