Don't repeat yourself

From Wikipedia, the free encyclopedia

(Redirected from Once and only once)
Jump to: navigation, search

Don't Repeat Yourself (DRY, also known as Once and Only Once or Single Point of Truth (SPOT)) is a process philosophy aimed at reducing duplication, particularly in computing. The philosophy emphasizes that information should not be duplicated, because duplication increases the difficulty of change, may decrease clarity, and leads to opportunities for inconsistency. DRY is a core principle of Andy Hunt and Dave Thomas's 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 change other logically-unrelated elements. Additionally, elements that are logically related all change predictably and uniformly, and are thus kept in sync.

Contents

  • In some small-scale contexts, the effort required to design around DRY may be far greater than the effort to maintain two separate copies of the data.
  • Imposing standards aimed at strict adherence to DRY could stifle community involvement in contexts where it is highly valued, such as a wiki.
  • Configuration management and version control allow multiple working copies of the same code without setting aside DRY. For example, good practice generally involves setting up development, testing, and production environments so that ongoing development and testing do not affect production code.
  • Human-readable documentation (from code comments to printed manuals) are typically a restatement of something in the code with elaboration and explanation for those who do not have the ability or time to read and internalize the code. However, DRY holds that if the human-readable document adds no value except the change in format, then it should be generated rather than written.
  • Source code generation - Generated code is a special case of a small-scale context (see first bullet point). We gain the benefits of large-scale duplication with minimal actual duplication.

  1. ^ Dave Thomas, interviewed by Bill Venners (2003-10-10). Orthogonality and the DRY Principle. Retrieved on 2006-12-01.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.