The code says everything once and only once, which is the essence of good design. -- Martin Fowler
[Time: 4:44 mins]
- Repititive code makes maintainance more difficult
- There are more places to change
- We may forget to change some of them
- Increases probability of bugs
- Types of repitition
- In methods in a class
- Accross the entire software
Example 1: DRY violated
|
Java2html |
Example 2: DRY honoured
|
Java2html |
Resources:
- http://www.artima.com/intv/dry.html
- http://c2.com/cgi/wiki?DontRepeatYourself
- http://c2.com/cgi/wiki?OnceAndOnlyOnce
Note: This post was originally posted on my blog at http://www.adaptivelearningonline.net
Comments