Composition or Inheritance, Which One Do You Prefer?
Published in
3 min readJul 7, 2020
Inheritance is a great principle in object-oriented programming where we can reuse code. But we have to be careful when using it because sometimes inheritance makes our code fragile.
We can always start building an application in javascript with simple objects and if we see that several objects share similar behavior then we can create a generic object with those features…