DEV Community

Discussion on: Clean, DRY, SOLID Spaghetti

Collapse
 
tensojka profile image
Ondřej Sojka

Excellent article! I'm definitely saving this.

IMHO applying SOLID (or "even only" DRY) to a code base too strictly almost always leads to better maintainability, but worse readability. It's much easier to change things, but it's hard to understand code when everything is abstracted. The decision to abstract or not to abstract is a complex tradeoff between readability and maintainability.

TL;DR the whole article: Don't blindly follow principles and use your brain. Find a balance between maintainability and readability.

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

Very true.

Ironically, poor readability damages practical maintainability; you can't maintain what you can't read. Meanwhile, less-maintainable code doesn't tend to be readable. So, while they're at odds with one another in one sense, they're paradoxically related in another sense.

Collapse
 
fkrautwald profile image
Frederik Krautwald

There is a way to deal with poor readability. It is known as Commenting Showing Intent (CSI): standards.mousepawmedia.com/csi.html

Thread Thread
 
codemouse92 profile image
Jason C. McDonald

Touché. :)

Of course, it doens't preclude good coding practice.