function doFirstBit() {}
function doSecondBit() {}
function big() {
let x,y,z;
[x,y] = doFirstBit();
[x,z] = doSecondBit(x, y);
}
to: function big() {
let x,y,z;
// First bit...
...
// Second bit...
...
}
To me, it's no harder to find the portion of interest in the latter when making a local change, and substantially easier to understand the whole thing (because you can sit down, maybe with a printout if that's your thing, and read through it linearly without having to jump back and forth to the subfunctions). And passing data between the portions can quickly end up nastier than my contrived example above, at which point people start doing things like creating a class just to hold what used to be the function's stack-frame.Not saying very long functions are something to celebrate. But if they're organised sensibly they're not a huge problem, and to be honest probably bother me less than functions which aren't abstracting anything terribly interesting and only get called once.