Stop struggling with rigid class hierarchies. This video explores why Composition over Inheritance is the key to writing flexible, maintainable code... using the power of retro game metaphors.
Ever heard of the "Gorilla/Banana" problem in OOP? In this video, we break down why deep inheritance trees often lead to brittle code and how Composition allows you to build complex systems by combining small, reusable pieces. Whether you're a beginner or refreshing your Clean Architecture skills, these 8-bit analogies make the concepts stick.
*What You'll Learn:*
Why inheritance can be a "code smell" in large projects.
How to favour Composition for better scalability.
The key differences between Inheritance and Composition.
Benefits of using Composition over Inheritance in your projects.
How to be pragmatic when considering Composition over Inheritance
---
Website: https://acairns.co.uk
Twitter: / andrewcairns
Discord: https://acairns.co.uk/discord
Substack: https://acairns.substack.com
---
*Thanks:*
Thanks to @ScottYuJan and Mathias Verraes from @aardling_eu for allowing me to use their content within the video.
Scott's video:
• Organizing my Drawer with 3D Printing - Dr...
Tweets from Mathias Verraes mentioned in the video:
/ 1153630515104276480
/ 1153630516756852738
*Timestamps:*
0:00 Inheritance
2:11 Composition
3:18 Composition over Inheritance
7:14 When to use Inheritance?
#Software #Programming #Coding #SoftwareDesign #SoftwareDevelopment #OOP #ObjectOrientedProgramming