LLMpediaThe first transparent, open encyclopedia generated by LLMs

Don't Repeat Yourself

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Expansion Funnel Raw 85 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted85
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
Don't Repeat Yourself
NameDon't Repeat Yourself
AbbreviationDRY
TypeSoftware development principle
Origin2002
AuthorAndy Hunt and Dave Thomas
First publicationThe Pragmatic Programmer
RelatedKISS principle, YAGNI, Separation of concerns, Single responsibility principle

Don't Repeat Yourself is a software development principle advocating that every piece of knowledge must have a single, unambiguous, authoritative representation within a system. Originating in modern software engineering practice, the principle influences design choices across programming languages, frameworks, databases, and documentation, and interacts with established practices from software architecture to configuration management.

History

The formulation most commonly cited was published by Andy Hunt and Dave Thomas in The Pragmatic Programmer, which followed earlier work on software craftsmanship in communities around Kent Beck, Ward Cunningham, and Martin Fowler. Adoption grew alongside the rise of Extreme Programming, Agile software development, and tooling from Sun Microsystems and Microsoft that made refactoring and reuse more tractable. Influences trace to classical ideas from Frederick Brooks and patterns popularized in Christopher Alexander's work, and it intersects with principles advocated at conferences such as OOPSLA and ACM SIGPLAN meetings. Over decades, discussions in forums tied to Linux Foundation, Apache Software Foundation, and corporations like Google and Facebook refined best practices and trade-offs.

Principles and Definition

At its core the principle prescribes a one-to-one mapping between knowledge and representation; this overlaps with concepts from Donald Knuth's literate programming and Edsger W. Dijkstra's emphasis on clarity. It is often taught alongside Refactoring, Design patterns catalogued by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, and it complements Model–view–controller and Domain-driven design approaches championed by practitioners such as Eric Evans. The rule is applied to source code, database schemas, configuration files, test suites, and documentation used by groups at organizations like IBM, Oracle Corporation, and Red Hat. Tension exists with principles like YAGNI and KISS principle when deduplication introduces premature abstractions criticized by figures such as Kent Beck.

Benefits and Trade-offs

Benefits cited in industry reports and books include reduced maintenance cost in case studies at Amazon (company), increased consistency in ecosystems like Android (operating system), and improved onboarding in projects stewarded by foundations such as Eclipse Foundation. Achieving the principle can reduce defect density noted in analyses by researchers affiliated with Carnegie Mellon University and Massachusetts Institute of Technology. Trade-offs arise when abstraction overhead hinders rapid prototyping advocated in Lean startup contexts or when centralization creates coupling discussed in papers from Stanford University and MIT Media Lab. Organizations such as Netflix and Spotify have documented situations where deliberate duplication was chosen to optimize deployment independence, reflecting engineering decisions highlighted by speakers at QCon and Strange Loop.

Implementation Techniques

Common techniques include extracting libraries and modules as practiced in ecosystems like npm, Maven, PyPI, and CPAN; employing database normalization approaches derived from work at IBM Research and universities like University of California, Berkeley; and using template systems prevalent in Django (web framework), Ruby on Rails, and Angular (web framework). Version control strategies in Git and Subversion enable refactorings that support the principle, while continuous integration systems such as Jenkins (software), Travis CI, and CircleCI enforce single sources of truth. Tooling includes static analysis from vendors like SonarSource and refactoring support in IDEs from JetBrains and Microsoft Visual Studio.

Examples and Case Studies

Classic examples include extracting authentication logic into shared modules used by projects at Mozilla Foundation and WordPress, consolidating business rules in domain models at companies such as Salesforce and SAP SE, and normalizing schemas in financial systems at institutions like Goldman Sachs and JPMorgan Chase. Open-source projects such as Linux kernel, PostgreSQL, and Apache HTTP Server show gradual consolidation of shared utilities over time, while platform efforts like Kubernetes and Docker (software) illustrate balancing reuse with independent release cadences. Case studies presented at conferences like IEEE Software and ACM workshops document measurable maintenance savings where DRY-aligned refactorings reduced bug rates in teams at Intel and Nokia.

Criticisms and Limitations

Critics including well-known practitioners warn that strict adherence can produce premature abstractions and brittle dependencies, a concern voiced in discussions by Martin Fowler and Joel Spolsky. Empirical studies by researchers at Harvard University and University of Cambridge highlight scenarios where duplication improved modularity and deployment autonomy for microservices architectures promoted by Amazon Web Services and Google Cloud Platform. Legal and organizational constraints at institutions such as European Commission and multinational firms can force duplication for compliance, and patterns advocated in Chaos Engineering and DevOps communities sometimes prioritize resilience over maximal deduplication.