# Code smell

> A "smell" is a metaphor for bad code, proposed by Kent Beck.

A "smell" is a metaphor for bad code, proposed by <Kent Beck>.

## Smells proposed in [Refactoring: Improving the Design of Existing Code](https://wiki.g15e.com/en/pages/Refactoring%20-%20Improving%20the%20design%20of%20existing%20code.txt)

Perhaps the list of smells begins with [Mysterious name](https://wiki.g15e.com/pages/Mysterious%20name.txt) and [Duplicated code](https://wiki.g15e.com/en/pages/Duplicated%20code.txt) because these two are the most important. In [Test-Driven Development: By Example](https://wiki.g15e.com/en/pages/Test-driven%20development%20-%20By%20example.txt), <Kent Beck> defines [refactoring](https://wiki.g15e.com/en/pages/Refactoring.txt) as "revealing intention and eliminating duplication."

- [Mysterious name](https://wiki.g15e.com/pages/Mysterious%20name.txt)
- [Duplicated code](https://wiki.g15e.com/en/pages/Duplicated%20code.txt)
- [Long function](https://wiki.g15e.com/pages/Long%20function.txt)
- <Long parameter list>
- [Global data](https://wiki.g15e.com/pages/Global%20data.txt)
- [Mutable data](https://wiki.g15e.com/pages/Mutable%20data.txt)
- <Divergent change>
- [Shotgun surgery](https://wiki.g15e.com/pages/Shotgun%20surgery.txt)
- [Feature envy](https://wiki.g15e.com/pages/Feature%20envy.txt)
- [Data clumps](https://wiki.g15e.com/pages/Data%20clumps.txt)
- [Primitive obsession](https://wiki.g15e.com/pages/Primitive%20obsession.txt)
- [Repeated switches](https://wiki.g15e.com/pages/Repeated%20switches.txt)
- [Loops](https://wiki.g15e.com/pages/Loops.txt)
- <Lazy element>
- [Speculative generality](https://wiki.g15e.com/pages/Speculative%20generality.txt)
- <Temporary field>
- [Message chains](https://wiki.g15e.com/pages/Message%20chains.txt)
- <Middle man>
- <Insider trading (code smell)>
- [Large class](https://wiki.g15e.com/pages/Large%20class.txt)
- <Alternative classes with different interfaces>
- [Data class](https://wiki.g15e.com/pages/Data%20class.txt)
- [Refused bequest](https://wiki.g15e.com/pages/Refused%20bequest.txt)
- [Comments](https://wiki.g15e.com/pages/Comments.txt)

## See also

- [Bad smells in test](https://wiki.g15e.com/pages/Bad%20smells%20in%20test.txt): Smells commonly found in test cases.