4 ms·
Good code tells a story. You should be able to read the code like English, starting with your inputs, and see how your inputs are transformed/processed into you
by Communitivity 5y ago
Good code tells a story. You should be able to read the code like English, starting with your inputs, and see how your inputs are transformed/processed into your outputs.
Good code is just simple enough. You can, through refactoring make code overly simple (think dozens of 1 line functions, where 3 5-12 line functions do the trick). A function is a scene though - no more, no less. Don't try to stuff a chapter or a novel into one function as that isn't simple at all.
Good code is commented with comments that explain and add meaning to the code, rather than repeating what is obvious from the code itself.
- thescribbblr 5y agoWow. Is there any way to avoid commenting on each line or at every function?
- philipswood 5y agoWell-chosen function names (where a function name says what it does), clear variable names (where the name makes it clear what it contains) and using well-named flags to factor complex conditions can make code read as clearly as prose.
- O_H_E 5y agoI understand what you (and @Communitivity) are saying. I know that feeling when code reads a bit like prose, but I'd seriously appreciate examples of public code that reads as clearly as prose
- Communitivity 5y agoSome source of good code: * https://github.com/keras-team/keras/ https://github.com/keras-team/keras/ * https://www.quora.com/Where-can-one-find-examples-of-good-quality-open-source-coding/answer/Toby-Thain https://www.quora.com/Where-can-one-find-examples-of-good-qu...