Don't repeat yourself

from Wikipedia, the free encyclopedia

Don't repeat yourself ( DRY , English for “ don't repeat yourself ”; also known as once and only once “once and only once”) is a principle that says to avoid or at least reduce redundancy . It is also a principle of clean code .

Software engineering

One area of ​​application for the DRY principle is, for example, programming .

Information that is redundant (for example, code duplicates in the source text ) can only be maintained uniformly with great effort. With systems that stay true to the DRY principle, changes only need to be made in one place.

While the DRY principle aims to avoid redundancy, the SPOT principle aims to deal with (intentional) redundancy.

DRY is a guiding principle in Andy Hunt and Dave Thomas' book The Pragmatic Programmer . They suggest using DRY for database descriptions, tests , scripts and documentation as well.

See also


Web links

Individual evidence

  1. Karl Eilebrecht, Gernot Starke: Patterns compact: Design patterns for effective software development. Springer-Verlag , p. 5 online
  2. ^ Hansruedi Tremp, Markus Ruggiero: Application Engineering. P. 140 Online
  3. Gernot Starke: Effective Software Architectures: A Practical Guide. Hanser Verlag , p. 117 online
  4. Neal Ford: Programming productively. O'Reilly Verlag , p. 6 online