3 ms·
I think you might have misunderstood my post. I'm not advocating having large functions over smaller functions. What I'm advocating is instead of breaking funct
by ratww 6y ago
I think you might have misunderstood my post. I'm not advocating having large functions over smaller functions. What I'm advocating is instead of breaking functions based purely on a visual criteria or by grouping functionality, it's better to use proper abstractions when breaking the function.
> You can just skip over it
The point is that if I blindly break a larger functions by functionality, I still have to understand the deeper functionality. So, I can't just skip when I'm debugging or deeply reviewing/inspecting the code, or doing a rewrite or trying to understand it.
> I can't help but think people who complain about this, are just bad at creating functions at the correct level of abstraction.
My point was exactly that you should create functions at the correct level of abstraction, rather than just splitting large functions purely by functionality, like you would with a cooking recipe.
> If your function does an unexpected side effect, thats a problem with the code
But this is exactly what I'm trying to avoid. If you need side effects, keep them visible, by keeping them in the main function, instead of just blindly putting them into smaller functions.
- UK-Al05 6y ago> The point is that if I blindly break a larger functions by functionality, I still have to understand the deeper functionality. So, I can't just skip when I'm debugging or deeply reviewing/inspecting the code, or doing a rewrite or trying to understand it. That's exactly what a well abstracted function should let you do. It only comes difficult with global state, and unexpected side effects. You should break up functions by intent.