ITWissen.info - Tech know how online

don´t repeat yourself (DRY)

DRY (Don't repeat yourself) is one of the principles that became popular in connection with the object-oriented design of software. With this principle it is to be expressed that code repetitions are to be avoided, so that once identified software functions are to be formulated also only once in the code.

The DRY code philosophy is also common in relation to the Model Driven Architecture( MDA), with which the software artifacts are derived from a central object model. DRY code is generated through data transformation and code generators that allow software developers to avoid what are known as copy and paste actions. Tools such as XDoclet and XLST are examples of the application of the DRY principle. Another example of code duplication is the configuration files when using Enterprise JavaBeans version 2.x. On the other hand, there are also examples of systems that explicitly supported the avoidance of code duplication. Here among other things the development environmentRuby on Rails or the Enterprise JavaBeans starting from the version 3.x are to be mentioned.

In software engineering the attention of the DRY principle is particularly interesting in relation to multi-tier architectures. The changes at data structures can have unpleasant effects on the entire system, if the principle was not considered during the code production. DRY was first introduced by Andy Hunt and Dave Thomas in their book The Pragmatic Programmer. The authors recommend thereby the attention of the principle in further phases of the development such as with the production of data base schemata, test and Build processes up to the documentation.

Further well-known principles are:

  • Keep it simple and stupid (KISS) - make it simple,
  • Separation of Concerns - Separation of concerns,
  • Open Closed Principle - Open to enhancements and closed to changes,
  • Program to Interface - Separation of the interface from the implementation,
  • Dependency Inversion Principle - Inversion of dependencies,
  • Inversion of Control Principle - Reversal of control flow, and
  • Single Responsibility Principle - principle of a single responsibility.
Informations:
Englisch: don´t repeat yourself - DRY
Updated at: 14.04.2010
#Words: 328
Links: connection, object (O), software (SW), code, relation
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024