> I would want that function to be multiple smaller functions with docstrings and such [...]
I have tried that style in the past, and have reverted to writing longer functions with intermittent comments.
I now consider "single caller functions" a smell.
If logic is serial (do A, then B, then C) it's fine to have serial code:
main() {
... A ...
... B ...
... C ...
}
The issue with splitting out the intermediate steps into functions is, that the serial flow is broken.
Instead of the logic now looks something like
I have tried that style in the past, and have reverted to writing longer functions with intermittent comments. I now consider "single caller functions" a smell.
If logic is serial (do A, then B, then C) it's fine to have serial code:
The issue with splitting out the intermediate steps into functions is, that the serial flow is broken. Instead of the logic now looks something like Where B might have been a tiny task, that is not worth splitting out. In effect:- The ordering of the logic is broken.
- Passing arguments can be a pain, if a lot of pieces are touched.
And what have you gained? Not sure there are many upsides besides debatable aesthetics of avoiding inline code comments.