4 ms·
I'm afraid you're talking about procedures returning values rather than functions. If so, then agreed. But 100 (pure) functions might be much easier to underst
by pkolaczk 12y ago
I'm afraid you're talking about procedures returning values rather than functions. If so, then agreed.
But 100 (pure) functions might be much easier to understand than a 100-line function with many loops, branches, jumps and complex internal state mutations. Assuming no recursive or mutually-recursive calls, you can convert 100 one-line functions to a flat function (no nesting, no loops) with 100 expressions.
Another difference in readability is in order - with 100 functions the order of evaluation does not matter, and with a 100 loc imperative procedure, the order of evaluation does matter and is additional thing to keep in mind.
- ajuc 12y agoThat's a big assumption. I don't think I've ever seen 100-lines long function with no dependencies between the 100 lines of code... Maybe in a constructor which calls 100 setters? Which is another great example why turning long functions into sea of one-liners isn't always a good thing.