Monday, September 5, 2022

Archiving Composition Over the Heritage With CDI Decorator and Delegator

Composite over inheritance is an OOP design principle we've followed for several years. Like me, you might have seen it in the Effective Java book, and we have wanted to pursue it since then. 

The inheritance brings several pitfalls, such as maintainability and a clear code. Beyond the semantics, the sample that I love to use is the cake that needs Salt. It does not make sense for a Cake to extend a Sea only because it needs Salt. In this case, it is a much better composition as well. 



from DZone.com Feed https://ift.tt/YKR07q8

No comments:

Post a Comment