DRY is not always practical

This article says it well. I am glad I am not alone.
https://programmingisterrible.com/post/176657481103/repeat-yourself-do-more-than-one-thing-and

I have applied the DRY principle numerous times. Sometimes I found myself messing with the abstract class or common function again and again, introducing more and more switches to deal with various combinations of params. In those moments, I secretly hoped that there was no abstraction at all. May it be repeated code, coz at least when I tweak one thing I know that I am only tweaking one thing but not the rest of the dependent code. DRY is a good principle for sure, but I hope that we don’t just blindly follow it to write “good” code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s