the original code, even before the float handling, was was a perf optimisation:
!!(~~i & 1);
Nobody wants to see that in code unless it has a name. Maybe isOdd(). Maybe we should put it on GitHub to save others time. Sure beats copy-pasting from StackOverflow.
Original:
Did you think of handling floats in your home built isOdd implementation? Thankfully Jon (EDIT: or one of his contributors - doesn't change the point) did. And they added tests.
The (flagged) article makes the staggering assumption that "we can't code" because we're not constantly reinventing the wheel. It talks about DRY being taken too far and talks about the functions being replaced as "one liners", when following a couple of links would show they're not. We can code, we're just coding on actual features, not rewriting the same poop.
Edit:
the original code, even before the float handling, was was a perf optimisation:
Nobody wants to see that in code unless it has a name. Maybe isOdd(). Maybe we should put it on GitHub to save others time. Sure beats copy-pasting from StackOverflow.Original:
Did you think of handling floats in your home built isOdd implementation? Thankfully Jon (EDIT: or one of his contributors - doesn't change the point) did. And they added tests.
The (flagged) article makes the staggering assumption that "we can't code" because we're not constantly reinventing the wheel. It talks about DRY being taken too far and talks about the functions being replaced as "one liners", when following a couple of links would show they're not. We can code, we're just coding on actual features, not rewriting the same poop.