3 ms·
I used to only make a function if a block of code was used in more than one place. But now if performance isn't an issue (for example a block of code that isn't
by mysterydip 5y ago
I used to only make a function if a block of code was used in more than one place. But now if performance isn't an issue (for example a block of code that isn't in a tight loop), I'll take a chunk that together does one thing and make it a self-descriptive function for readability purposes.
Instead of:
function foo() {
// this does abc
big block of code
// this does def
big block of code
...
etc
}
and having a function I have to scroll pages through, I now do this:
function foo() {
DoABC()
DoDEF()
}