Tom Ritchford
Jan 7, 2022

--

A decent article as far as it goes, but you are missing two key features of OOP: code reuse and encapsulation.

OOP is probably the most commonly used code organization technique, because it works, and even the most junior developers can use it.

I use a more functional approach when it makes sense, and that's quite a lot, but I love classes and objects too.

And the number one trap in OOP is pretty straight-forward - it's using inheritance for code reuse and not composition (also called delegation).

Nearly all the time, inheritance should only be used because of polymorphism.

--

--

No responses yet