Object Oriented Tricks: #6 SLAP your functions
Arun Sasidharan
5618

I am not sure I agree, consider the following:

function evaluateSomething(arg1, args...) {
var localVar = 0;
arg1.forEach(function(arg1elements) {
// some operation with arg1elements
localVar += operationResult;
});
return (something else + localVar + arg2 + arg3...etc);
}

My function is doing one identifiable thing and if split into various functions I think becomes less readable since the context is gone, so I believe good style can’t just originate from a syntactic rule (writing one line functions), but rather from the outset (what is it you are doing and how would you explain it in words) and from there break it down into readable testable chunks, hunting for one line functions that just return one value breaks cadence, so I agree with the general sentiment but think extracting everything might be too much.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.