Rethinking DRY (Don't Repeat Yourself)
I recently discovered MaintainableCSS by Adam Silver, and it’s changed my view of what it means for code to be DRY (Don’t Repeat Yourself). Adam is a fantastic developer, by the way—definitely check him out!
In particular, I like Chapter 3: Reuse. I could easily post the whole thing here, but I’ll share the opening quote from Harry Roberts:
As Harry Roberts says, “DRY is often misinterpreted as the necessity to never repeat the exact same thing twice. This is impractical and usually counterproductive, and can lead to forced abstractions, over-thought and over-engineered code.”
Hell fucking yes! 👏
I often obsess over this, and it always ends up:
- Making my code more complicated;
- Making me less productive; or
- Both of the above.
I highly recommend reading the whole chapter. It’s only ~600 words 👍
If you have questions, feedback, or any other suggestions, please do email me. I'd love to hear from you!