4 ms·
Or in other words: code should be as simple as possible, but no simpler. I guess you could call it organization or readability or just good design. It require
by o_nate 11y ago
Or in other words: code should be as simple as possible, but no simpler. I guess you could call it organization or readability or just good design. It requires deeply understanding what you're trying to accomplish and structuring your code to reflect that. I don't think there's any rote, step-by-step procedure that will get you there. Often it is a flash of creative insight that breaks the log-jam and reveals the hidden inner structure of the problem. Once that is revealed the code writes itself. In other words, good code should always make the problem that was solved look easy.
- blakeyrat 11y agoDevelopers understand the word "simple" in different ways. I personally think of the UI/API: what the code exposes to the outside world should be "simple". Some people might think about language features. "Simple" is being very selective about what language features you use and what you avoid. Others might think design patterns, and think the code is "simple" when you can point to any class and immediately recognize what pattern that class implements. I've come to learn the word "simple" as in KISS (Keep It Simple, Stupid) isn't very useful at all.
- o_nate 11y agoI was thinking of more than the UI/API, although I agree that should be simple as well. I think the internals of the code should be simple, in the sense of being constructed out of simple parts with each part being simply connected to the other parts. This means each method should have a clear purpose and it should accomplish it cleanly without surprising side-effects, and that the flow of method calls should be straightforward.