3 ms·
There's a short list of reasons to factor out a method. The most popular one is "if you see the need for inline comments for a block of code, maybe the code sho
by hinkley 4y ago
There's a short list of reasons to factor out a method. The most popular one is "if you see the need for inline comments for a block of code, maybe the code shouldn't be inline", but feeling the need to redefine a variable, especially in the middle of a function, is often a good indicator of a new scope starting. Sending variable foo with an increment, a merge, or a concatenation to another function is fairly readable. Having foo and foo' inline is quite a bit harder on working memory.