๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Programming Concepts Beginner

What is DRY (Don't Repeat Yourself)?

A software development principle that aims to reduce code duplication by abstracting common patterns into reusable components.

DRY states that every piece of knowledge should have a single, unambiguous representation in a system. Duplicate code means duplicate bugs and duplicate maintenance effort. Extract common logic into functions, classes, or modules.

However, premature abstraction can be worse than duplication. The "Rule of Three" suggests abstracting only after seeing the same pattern three times. WET (Write Everything Twice) and AHA (Avoid Hasty Abstractions) are counterbalancing principles that warn against over-abstraction.

Related Terms

Binary Search
An efficient search algorithm that finds a target value in a sorted array by repeatedly dividing the search interval in half.
Technical Debt
The implied cost of additional rework caused by choosing a quick solution now instead of a better approach that would take longer.
Functional Programming
A programming paradigm that treats computation as the evaluation of mathematical functions, avoiding state changes and mutable data.
Linked List
A linear data structure where elements are stored in nodes, each containing data and a pointer to the next node in the sequence.
Closure
A function that captures and retains access to variables from its enclosing scope, even after that scope has finished executing.
Composition over Inheritance
A design principle favoring object composition (has-a relationships) over class inheritance (is-a relationships) for code reuse.
View All Programming Concepts Terms โ†’