DEV Community

Jonathan Hall
Jonathan Hall

Posted on • Originally published at jhall.io on

3 1

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.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay