DEV Community

Discussion on: OOP Overkill

Collapse
 
mrlarson2007 profile image
Michael Larson • Edited

You have to ask your self why is OOP so popular? What is it good for? The key here is polymorphism. This is what allows us to be able to have inversion of control and in turn allows us to use SOLID.

With polymorphism I can build an application with extensions, allowing others to extend my application with out knowing or caring. I can also do things like composition to reuse code between various parts of my application. I can use inversion of control to insert a mock implementation of my datalayer allowing my tests to run fast. Or test any other part of my system in isolation. This is all possible in statically type languages using OOP.

Collapse
 
mrlarson2007 profile image
Michael Larson

I use interfaces and abstract types to define my contracts and I can easily replace the implementations with mocks or test doubles when writing tests.