DEV Community

Discussion on: 4 Pillars Of Object-Oriented Programming (Made Easy)

Collapse
 
phantas0s profile image
Matthieu Cneude

Some advice (only my opinion, of course):

  1. Abstraction is not only for OOP. You can abstract away details nobody cares in most programming languages. My take: thevaluable.dev/abstraction-type-s...
  2. Inheritance as you describe it should be rarely used, and especially not to share code as you do in your example. Otherwise, it will be difficult to modify one of your children without modifying the parent... it makes everything tightly coupled, which is often not what you want. I've written about that here: thevaluable.dev/guide-inheritance-...
  3. It's safer to use interface constructs to achieve polymorphism. Again, using inheritance here makes everything highly coupled.
  4. Many functional languages implement different ways to achieve polymorphism too...
Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thanks for the knowledge man.