“The existence of
ifstatements in this code signals duplication, because the caller already knows which path it wants the callee to follow. In a misguided attempt to remove duplication, the programmer had brought together functionality that didn’t belong together, and in so doing had created more duplication.”
This is from a blog post I wrote almost seven years ago, called if…. At the time, and in the context of the projects I was working on then, it contains some radical ideas. It’s nice to see that they still apply today.