Choose Delegation Over Inheritance, Really ?! By Venkat Subramaniam
ฝัง
- เผยแพร่เมื่อ 26 ส.ค. 2024
- We all have read good books that tell us to choose delegation over inheritance. Yet, we often choose inheritance? Why is that?
In this presentation we will discuss the reasons, from the OO design point of view when we should choose inheritance and when we should choose delegation. Then we will discuss why we tend to lean towards inheritance. We will then model a problems to use delegation, using Java (plus some libraries), Groovy, and Kotlin and achieve fluent implementations of delegation. We will conclude with good recommendations on when to choose which approach.