3 ms·
Writing code has many analogs to writing prose. If you were writing a letter and you only used small sentences, it'd be irritating to read and probably difficul
by rufius 9y ago
Writing code has many analogs to writing prose. If you were writing a letter and you only used small sentences, it'd be irritating to read and probably difficult to follow.
Rather than dogmatically applying "no small functions" or "break functions down as much as possible" it's more useful to look at how the code communicates the idea (and achieves the goal).
If the function is calling 30 things before it does the 4 things that logically map to the function name, maybe consider refactoring out all or parts of the preceding 30 steps.
- pvg 9y agoFunctions and other forms of structural and semantic composition are among the (many) things that make writing prose entirely unanalogous to writing code. You can't sprinkle prose with "descriptiveParagraph(targets, descriptors)" or "dialogScene(characters, lines)".