Composition–the modern, flexible "has a" style
So, inheritance seems great, doesn't it? You can keep your code really DRY by defining commonly used functionality in a parent or abstract class and then share that across a huge number of children. That's what a lot of people thought a few years ago, and then they worked on Magento…
What does DRY mean?
DRY stands for "don't repeat yourself" and with regards to coding, it means avoid copy-pasting and duplicating code and instead structure things so that any code that needs to be reused is packaged up in a way that facilitates that. It could be as simple as a global function or constant or could be a full-blown class that encapsulates the bundle of functionality that you want to share.
If we went with the hugely overused analogy of animals when discussing inheritance, then we could define a whole taxonomy with AbstractOrganism
at the top and then child classes all the way down&...