3 ms·
Here's what I generally follow (there are exceptions, of course): 1. Functions can do 90% of what you need in terms of code organization and maintainability.
by hliyan 6y ago
Here's what I generally follow (there are exceptions, of course):
1. Functions can do 90% of what you need in terms of code organization and maintainability.
2. Don't try to get functions to do more than one job. Don't try to spread one job across multiple functions.
3. Name functions using concrete, unambiguous verbs. No: handleX, doX, processX, updateX. Yes: get/setX (from/to memory), fetch/sendX (over network), load/saveX (from disk), calculateX (and return value), findX (in list).