3 ms·
Exactly. Reuse through conditionals is a trap. “Look! I made a reusable thing!” No, you made a choke point. Dedupe what you can, then compose with the other 10%
by dimal 4y ago
Exactly. Reuse through conditionals is a trap. “Look! I made a reusable thing!” No, you made a choke point. Dedupe what you can, then compose with the other 10% when you need it. No need to complect it, as Rich Hickey would describe it.
- steve_adams_86 4y agoI think composition is often the tool that’s needed when trying to hit two birds with one stone, but not reached for as often as it should be. Although conditional statements are totally useful and essential, I find their overuse tends to look like the logic is especially departed from the data structures it operates on. On the other hand, composition tends to accomplish the opposite — it reads with clearer intent and reveals more about what’s similar or dissimilar in various parts of your data. It’s totally possible to compose poorly too, of course. Plenty of ways to write awful code :)