0

DRY can be expensive

 2 years ago
source link: https://dev.to/tinydevops/dry-can-be-expensive-k5
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Jonathan Hall

Posted on Nov 15

• Originally published at jhall.io on Nov 12

DRY can be expensive

If I’ve told you once, I’ve told you a thousand times: I never repeat myself.

And neither should you! Right? Don’t repeat yourself, or the DRY principle tells us this.

There are many ways to apply the DRY principle in IT systems. In code, it can be as simple as extracting a common behavior into a function that can be called from multiple places.

But when can DRY be harmful? Here are a few cases…

  1. It breaks the flow of the code
  2. It adds new dependencies to manage
  3. Too many abstractions can be hard to follow
  4. The wrong abstraction is used (often caused by premature optimization)

If you enjoyed this message, subscribe to The Daily Commit to get future messages to your inbox.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK