|
|
|
|
|
by stephc_int13
2040 days ago
|
|
I've been writing code for more than twenty years now and I had the opportunity to try many different styles. It is, unfortunately, very easy to write difficult to read code, especially with good intentions and principles. In practice, I've found that the most important principle is Locality, that is avoiding nested indirections and unecessary abstractions. I completely agree with the author of the article here, the simple and dumb recipe with constants local values is both easy to read and easy to maintain. It might seems like duplication but the complexity has to live somewhere and it is more manageable when it is not scattered. |
|
The issue I often see is that when abstractions are created, the thought process or design of those abstractions aren't well explained. When you create abstractions, more verbose documentation and design is needed to share the ideas. Anyone using this in the future needs to understand your abstractions and there's a cognitive cost of dealing with it.
You reduce this cost when you explain everything well, give examples, show use cases, etc. When you don't provide this sort of verbose documentation, you might as well have made it a large sequential program because it likely would have been easier for the next person to understand.