3 ms·
Good code explains the problem to the reader and implements the solution as a side effect. You can often express the problem quite well using a combination of
by mslot 5y ago
Good code explains the problem to the reader and implements the solution as a side effect.
You can often express the problem quite well using a combination of if, for, comments, variable names, function names, list/set and map data structures.
Sometimes (<10%) you encounter a problem that's interesting enough to define a custom type, and sometimes you make tree data structure out of it (<1%). On very rare occasions (<0.1%), you need a more complex data structure.
Code that uses thousands of classes is very hard for a reader to approach, but so is a single file with a never-ending ifs and for loops. Always write code for another person. If nothing else that other person might be you in a few months (or much sooner).
Coding is basically just writing for humans in a language a computer can execute.