DRY - Don't Repeat Yourself


DRY is a principle of software engineering that says that Duplication Is EVIL. I think we all agree with that, but it is important to notice that not duplicating can ALSO be evil, if you don place things correctly.

(from Wikipedia)
In software engineering, Don't Repeat Yourself (DRY) or Duplication Is Evil (DIE) is a principle of software development aimed at reducing repetition of information of all kinds, especially useful in multi-tier architectures. The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." The principle has been formulated by Andy Hunt and Dave Thomas in their book The Pragmatic Programmer. They apply it quite broadly to include "database schemas, test plans, the build system, even documentation." When the DRY principle is applied successfully, a modification of any single element of a system does not require a change in other logically-unrelated elements. Additionally, elements that are logically related all change predictably and uniformly, and are thus kept in sync. Besides using methods and subroutines in their code, Thomas and Hunt rely on code generators, automatic build systems, and scripting languages to observe the DRY principle across layers.

How NOT to repeat yourself

Know what each "box" (layer of the Logical Architecture) and what to put into each one of them. That will probably give you strong hints of how NOT to repeat yourself.

Further Reading

Last edited Sep 10, 2011 at 12:29 AM by hudsonmendes, version 6


No comments yet.