Contribute Media
A thank you to everyone who makes this possible: Read More

Slow Down, Compose Yourself


As your codebase grows, you will have instances where you have code that needs to be reused. Then you think, I can do this with subclassing! Now you have a diamond-tree of problems.

Here, we’ll talk about a better way of code reuse and introducing alternate behaviour into existing classes — composition. It’ll improve how you test your code — making your test runs faster, making it easier to test exceptional cases, and making everything easier to understand.


Improve this page