## Duplicated code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

> Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

## Refactorings

*   [Extract Method](http://sourcemaking.com/refactoring/extract-method)
*   [Extract Class](http://sourcemaking.com/refactoring/extract-class)
*   [Form Template Method](http://sourcemaking.com/refactoring/form-template-method)
*   [Introduce Null Object](http://sourcemaking.com/refactoring/introduce-null-object)
*   [Pull Up Method](http://sourcemaking.com/refactoring/pull-up-method)
*   [Pull Up Field](http://sourcemaking.com/refactoring/pull-up-field)
*   [Substitute Algorithm](http://sourcemaking.com/refactoring/substitute-algorithm)

## Further Reading

*   [Don't Repeat Yourself](http://c2.com/cgi/wiki?DontRepeatYourself) on the C2 Wiki
*   [Duplicated Code](http://sourcemaking.com/refactoring/duplicated-code) on SourceMaking
*   [Refactoring: Improving the Design of Existing Code](http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672) by Martin Fowler. _Duplicated Code_, p76

Add a markdown-formatted read up about duplication
Add a markdown-formatted read up about duplication
