3 ms·
It helps with that, but it has other trade-offs: indirection isn't free for readability.
by williamdclt 11mo ago
It helps with that, but it has other trade-offs: indirection isn't free for readability.
- throw10920 11mo agoI'll go further than that and say that indirection significantly increases cognitive load and hurts readability.
- zahlman 11mo agoI have consistently found the opposite to be the case across decades of programming experience, as regards the extraction of helper functions. This is not "indirection" in the same sense as with data structures. It is abstraction of currently-irrelevant detail. Reading and understanding code is a process of answering "what are the immediate steps of this task?", without thinking about what those steps consist of or entail. It is not a process of answering "where is the variable representing ..., and the code that manipulates this?", especially since this makes assumptions that may prove incorrect.
- tengbretson 11mo ago> indirection isn't free for readability Yes, but also no. If its a mostly side-effect free function with a good name and well defined input/output types its basically free.