3 ms·
There problem here is that now you need to scan beyond the function signature to see what the parameters are for. It also makes it impossible for your text edit
by kstenerud 8y ago
There problem here is that now you need to scan beyond the function signature to see what the parameters are for. It also makes it impossible for your text editor or IDE to tell you anything about the function call you're hovering over besides 'n'.
The idea is to reduce cognitive load as much as possible for someone navigating your code. Every line the reader has to read increases cognitive load, and slows him down.
- skybrian 8y agoTo me, this is sort of like saying you shouldn't use pronouns in English because they assume you've read the previous few sentences. It's possible, but it results in rather stilted prose. There are situations where text needs to stand alone (such as tweets) but I think a function call is too narrow a focus. The body of a reasonably-sized function seems like a more natural chunk for understanding a program.