Don't repeat yourself

Don't repeat yourself

In software engineering, Don't Repeat Yourself (DRY) or Duplication Is Evil[citation needed] (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."[1] 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.

Contents

Applying DRY

Also known as Single Source of Truth, this philosophy is prevalent in model-driven architectures, in which software artifacts are derived from a central object model expressed in a form such as UML. DRY code is created by data transformation and code generators, which allows the software developer to avoid copy and paste operations. DRY code usually makes large software systems easier to maintain, as long as the data transformations are easy to create and maintain. Tools such as XDoclet and XSLT are examples of DRY coding techniques. Examples of systems that require duplicate information are Enterprise Java Beans version 2, which requires duplication not just in Java code but also in configuration files. Examples of systems that attempt to reduce duplicate information include the Symfony, web2py and Django web frameworks, Ruby on Rails application development environment and Enterprise Java Beans version 3.

Kent Beck has mentioned that he does not "subscribe to [DRY] for test code because zz[he] want[s] [his] tests to read like a story".[2]

See also

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Don’t repeat yourself — (DRY, рус. Не повторяйся)  это принцип разработки программного обеспечения, нацеленный на снижение повторения информации различного рода, особенно в системах со множеством слоёв абстрагирования. Принцип DRY формулируется как: «Каждая часть… …   Википедия

  • Don't Repeat Yourself — Don’t Repeat Yourself (DRY, auch bekannt als Once and Only Once, dt. etwa: Wiederhole dich nicht) ist ein Prinzip, das besagt, Redundanz zu vermeiden oder zumindest zu reduzieren. Ein Anwendungsgebiet für das DRY Prinzip ist z. B. die… …   Deutsch Wikipedia

  • Don't repeat yourself — Don’t Repeat Yourself (DRY, auch bekannt als Once and Only Once, dt. etwa: Wiederhole dich nicht) ist ein Prinzip, das besagt, Redundanz zu vermeiden oder zumindest zu reduzieren. Ein Anwendungsgebiet für das DRY Prinzip ist z. B. die… …   Deutsch Wikipedia

  • Don’t repeat yourself — Dieser Artikel wurde zum Export in das Software Wiki angemeldet. Däädaa 20:00, 18. Nov. 2011 (CET) …   Deutsch Wikipedia

  • Don't Repeat Yourself — Ne vous répétez pas Ne vous répétez pas (Don t Repeat Yourself) est une philosophie en programmation informatique consistant à éviter la redondance de code au travers de l ensemble d une application afin de faciliter la maintenance, le test, le… …   Wikipédia en Français

  • Don't repeat yourself — Ne vous répétez pas Ne vous répétez pas (Don t Repeat Yourself) est une philosophie en programmation informatique consistant à éviter la redondance de code au travers de l ensemble d une application afin de faciliter la maintenance, le test, le… …   Wikipédia en Français

  • repeat — re|peat1 W2S2 [rıˈpi:t] v [T] ▬▬▬▬▬▬▬ 1¦(say again)¦ 2¦(do again)¦ 3¦(learn)¦ 4¦(tell)¦ 5¦(broadcast)¦ 6 something doesn t bear repeating Phrasal verbs  repeat on somebody ▬▬▬▬▬▬▬ [Date: 1300 1400; : Old F …   Dictionary of contemporary English

  • repeat — I UK [rɪˈpiːt] / US [rɪˈpɪt] verb [transitive] Word forms repeat : present tense I/you/we/they repeat he/she/it repeats present participle repeating past tense repeated past participle repeated *** 1) to say or write something again Can you… …   English dictionary

  • repeat — re|peat1 [ rı pit ] verb transitive *** 1. ) to say or write something again: Can you repeat what you just said, please? The first line is repeated throughout the poem. If you repeat those allegations, we will consult our lawyers. repeat that: He …   Usage of the words and phrases in modern English

  • repeat — 1 /rI pi:t/ verb 1 STATE AGAIN (T) to say or write something again: Can you repeat your question? | repeat that: Steven repeated patiently that he was busy. see say 1 2 DO AGAIN (T) to do something again: Repeat the treatment twice a day if… …   Longman dictionary of contemporary English

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”