DEV Community

Discussion on: The ONE book every developer MUST read!

Collapse
 
bootcode profile image
Robin Palotai

Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control.

There is an unresolvable paradox here. I agree that if you want to read code like prose, it must consist of abstractions. Otherwise the nitty-gritty details would have to be exposed. But remember, abstractions likely take you away from the "direct" and "straightforward".

  1. It's one more level in your mental stack to balance. The question lingers in your head, ok, what does it actually do in this case?

  2. Often, abstractions can't be made "crisp", they are rather leaky.

Abstractions (aka how to partition concepts, where to draw lines) are hard to get right the first time. You need a good few iterations on them to begin with.

Even a good partitioning of concepts can be ruined later, when a new kind of edge-case needs to be handled. A tiny detail changes, the whole design needs to be revised. In reality, the tiny edge-case is often addressed at a place it doesn't really belong, making the nice prose lie.

Not complaining, just noting. Don't be shy of exposing details if that makes sense. Start to abstract one you see a pattern recur 3-5 times and have a good grasp on the various edge cases. Always be wary.

Thread Thread
 
codemouse92 profile image
Jason C. McDonald

Code has a nasty little tendency to be paradoxical, doesn't it? XD

"Clean coding" principles always require careful thought; Clean, DRY, SOLID Spaghetti is still spaghetti. :P

Some comments have been hidden by the post's author - find out more