Code smell 234034 222409732 2008-06-29T05:30:20Z Gandalfgeek 624660 /* Common code smells */ In [[computer programming]], '''code smell''' is any [[symptom]] in the [[source code]] of a [[computer program]] that indicates something may be wrong. It generally indicates that the code should be [[refactoring|refactored]] or the overall design should be reexamined. The term appears to have been coined by [[Kent Beck]] on [[WardsWiki]]. Usage of the term increased after it was featured in ''Refactoring. Improving the Design of Existing Code''. Determining what is and is not a code smell is often a subjective judgment, and will often vary by language, developer and development methodology. == Common code smells == * Duplicate code: identical or very similar code exists in more than one location. * Large method: a [[Method (computer science)|method]], function, or procedure that has grown too large. * Large class: a [[Class (computer science)|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 [[Method overriding (programming)|override]]s 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. * Duplicated method: a method, function, or procedure that is very similar to another. * Contrived Complexity: forced usage of overly complicated [[Design pattern (computer science)|design patterns]] where simpler design would suffice. ==See also== *[http://www.soberit.hut.fi/mmantyla/BadCodeSmellsTaxonomy.htm Taxonomy of code smells] ==References== *[http://c2.com/cgi/wiki?CodeSmell CodeSmell at c2.com] *{{cite book | first = Martin | last = Fowler | authorlink = Martin Fowler | year = 1999 | title = Refactoring. Improving the Design of Existing Code | publisher = Addison-Wesley | id = ISBN 0-201-48567-2 }} [[Category:Anti-patterns]] [[de:Smell (Programmierung)]] [[pl:Zapachy kodu]]