I don’t like nesting single use functions.
At a certain point this is necessary due to overall length. You don't want a single function that is hundreds of lines long - they suck to debug and to test. Single-use functions break that up into logical chunks that make it easier to understand.
The moment I follow a function and it’s just another abstraction for more functions I start feeling dread.
This can actually be ideal in many cases due to the Single-responsibility Principle. Think of the purpose of those functions as coordinating the workflow of the other functions.
coloredgrayscale@programming.dev 1 year ago
Think of it more like bigger building blocks rather than single use functions. If there is an issue with the pizza arriving burnt black at the customer you don’t want to read through the logic for making the dough and adding toppings if the most likely cause is the oven.
Sure, you could add comment blocks to mark the sections. But you can’t easily jump to that exact point. With function names you can easily skim over the unimportant calls, or go through a list of functions/methods in the file and jump there directly. With comments that’s not a standard feature in IDEs.
But I understand your argument about following through multiple layers of abstractions. That’s something that irritates me as well a bit, if you follow a function, that does nothing, but pass the same parameters through another function and return the result.
No guard clauses, or changes to the data, just 1:1 pass-through. And this them goes 2-3 levels deep before reaching real code again. Bonus of they all are in different files too.