What is “Code smell”?

Just got this piece from SearchWinDevelopment newsletter:

A code "smell" is a way of saying that there is potentially a problem with your code.

Wikipidea says:

code smell is any symptom in the source code of a program that possibly indicates a deeper problem.

Common code smells:

  • Duplicate code: identical or very similar code exists in more than one location.
  • Large method: a method, function, or procedure that has grown too large.
  • Large class: a class that has grown too large, see God object.
  • Feature envy: a class that uses methods of another class excessively.
  • Inappropriate intimacy: a class that has dependencies on implementation details of another class.
  • Refused bequest: a class that overrides a method of a base class in such a way that the contract of the base class is not honored by derived class. See Liskov substitution principle.
  • Lazy class: a class that does too little.
  • Contrived Complexity: forced usage of overly complicated design patterns where simpler design would suffice.
 

What is “Code smell”?

Just got this piece from SearchWinDevelopment newsletter:

A code "smell" is a way of saying that there is potentially a problem with your code.

Wikipidea says:

code smell is any symptom in the source code of a program that possibly indicates a deeper problem.

Common code smells:

  • Duplicate code: identical or very similar code exists in more than one location.
  • Large method: a method, function, or procedure that has grown too large.
  • Large class: a class that has grown too large, see God object.
  • Feature envy: a class that uses methods of another class excessively.
  • Inappropriate intimacy: a class that has dependencies on implementation details of another class.
  • Refused bequest: a class that overrides a method of a base class in such a way that the contract of the base class is not honored by derived class. See Liskov substitution principle.
  • Lazy class: a class that does too little.
  • Contrived Complexity: forced usage of overly complicated design patterns where simpler design would suffice.