DEV Community

Discussion on: Why composition is superior to inheritance as a way of sharing code

Collapse
 
exadra37 profile image
Paulo Renato

Hi Rui,

Excellent and simple article about Inheritance vs Composition.

After I read the book Pragmatic Programmers and Clean Code I gradually changed the way I code to the point I don't use Inheritance unless forced by the Framework I am using.

Composition === Explicit Code

Inheritance === Implicit Code

Nowadays I am 100% in favour of being Explicit over being Implicit.