๐ŸŽ 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

Immutable Object
An object whose state cannot be modified after creation, providing thread safety and predictable behavior in concurrent systems.
Regex (Regular Expression)
A sequence of characters that defines a search pattern, used for string matching, validation, and text manipulation.
Clean Code
Code that is easy to read, understand, and maintain โ€” following consistent conventions, meaningful naming, and single-responsibility functions.
Recursion
A programming technique where a function calls itself to solve a problem by breaking it into smaller subproblems.
Stack
A data structure that follows Last-In-First-Out (LIFO) ordering, where elements are added and removed from the same end (top).
Agile
A software development methodology that emphasizes iterative development, collaboration, and rapid response to change.
View All Programming Concepts Terms โ†’