The Pros and Cons of DRY Code
The post The Pros and Cons of DRY Code first appeared on Qvault . Clean code is like clean garbage – it’s only truly clean if it doesn’t exist. In other words, the only clean code is no code . Let’s start with an acknowledgment that a perfectly clean (empty) codebase is useless. With that in mind, our pursuit of clean code will necessarily consist of tradeoffs. We’ll trade usefulness for cleanliness, complexity for speed, ownership for ease of development, and abstractions for reusability. DRY (don’t repeat yourself) code is often held aloft as an ideal in the quest for clean code. Let’s explore why I think DRY can be a good heuristic , but far from an absolute. What is DRY Code? According to Wikipedia : Don’t repeat yourself is a principle aimed at reducing repetition of software patterns, replacing it with abstractions or using data normalization to avoid redundancy. Every piece of knowledge must have a single, unambiguous, authoritative representation with...