2 ms·
"We can then separate out that complexity even further if we move the determination of the value of paid_today into its own function." Ouch, and this immediate
by jacknews 3y ago
"We can then separate out that complexity even further if we move the determination of the value of paid_today into its own function."
Ouch, and this immediately makes it less obvious what's going on, because you have to look up the function. In this case, the name is self-documenting, but that's far from always the case. And even then the extracted function seems to conflate 2 concepts, 'pay day', and 'eligible to be paid', and the code even looks suspect/buggy; which is more clearly unambiguous:
(one and two or three)
(one and (two or three))
This kind of extraction is only useful if you need to re-use the encapsulated calculation IMHO, otherwise just comment each term, or use something more powerful than "if and or then", eg decision tables, etc.