... | @@ -18,6 +18,31 @@ __C2: Obsolete Comment__ |
... | @@ -18,6 +18,31 @@ __C2: Obsolete Comment__ |
|
A comment that has gotten old, irrelevant, and incorrect is obsolete. Comments get old quickly. 1t is bestnot to write a comment that will become obsolete. If you find an obsolete comment, it is best to update it or get rid of it as quickly as possible. Obsolete comments tend to migrate away from the code they once described. They become floating islands of irrelevance and misdirection in the code.
|
|
A comment that has gotten old, irrelevant, and incorrect is obsolete. Comments get old quickly. 1t is bestnot to write a comment that will become obsolete. If you find an obsolete comment, it is best to update it or get rid of it as quickly as possible. Obsolete comments tend to migrate away from the code they once described. They become floating islands of irrelevance and misdirection in the code.
|
|
|
|
|
|
|
|
|
|
|
|
__C3: Redundant Comment__
|
|
|
|
|
|
|
|
A comment is redundant if it describes something that adequately describes itself. For example:
|
|
|
|
|
|
|
|
```java
|
|
|
|
|
|
|
|
i++; II increment i
|
|
|
|
|
|
|
|
```
|
|
|
|
Another example is a Javadoc that says nothing more than (or even less than) the function signature:
|
|
|
|
|
|
|
|
```java
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ®param sellRequest
|
|
|
|
* ®return
|
|
|
|
* ®throws ManagedComponentException
|
|
|
|
*/
|
|
|
|
public SellResponse beginSellitem(SellRequest sellRequest)
|
|
|
|
throws ManagedComponentException
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Comments should say things that the code cannot say for itself.
|
|
|
|
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
... | | ... | |