2 ms·
I 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 conditi
by steve_adams_86 4y ago
I 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 :)