Re:Recombine to avoid naming when naming is hard
by Ma8ee on Monday July 06, 2015 @12:32PM
(#9840265)
I hope that the very generic names you have chosen is just for the example, but otherwise that is exactly the type of names that make a codebase incomprehensible. How about something like
function CalculateSalesBonus(err, salesmenEmployedByTheLastOfMonth) {
// do stuff
}
which actually contains much more information than db.getSalesmenEmployedByTheLastOfMonth(function (err, data) {
//blah blah does stuff
});
So, sure, you can write:
But it's actually a lot simpler and more understandable if you just write: If and when you ever need to break that function out into something re-usable, give it a name then, but don't bother with a name unless you need it.