DEV Community

Cover image for What's the Deal with OOP?
Ben Halpern for CodeNewbie

Posted on

What's the Deal with OOP?

Can you help a CodeNewbie out and explain the concept of OOP (Object-oriented programming) in simple terms? It would be extra awesome if you could share an example of how you've implemented OOP principles in one of your projects. Maybe you've utilized classes, inheritance, or encapsulation?

Tell us about your experience and how OOP has enhanced your projects.

Follow the CodeNewbie Org and #codenewbie for more discussions and online camaraderie!

Top comments (5)

integerman profile image
Matt Eland

OOP is just a reference to song lyrics:

OOP I did it again
refactored my code
made it make sense
Oh, maintainability.
OOP, I think I'm in love
Makes my code make sense
And become reusable

But I don't know. I'm not that musically literate.

ryencode profile image
Ryan Brown

Seeing your comment got:

You down with OOP (Yeah you know me),

stuck in my head... I can't make anything more of it, but I believe this ages me :D

polterguy profile image
Thomas Hansen

I could be honest, but then I'd be slaughtered I guess ;)

However, study SOLID principles and design patterns, and look at code examples, preferably created by seniors, with an understanding of architecture and try to understand why the code is the way it is ... ^_^

jmfayard profile image
Jean-Michel ( • Edited

I would say learn OOP from people who can explain it well
Beware of the people that treat it as a dogma, aka some Uncle Bob fans.
Practice what you have learnt.
And then keep the parts that serve you well and search a replacement for the rest

In short be agile.

velydev profile image

In the beginning, long time ago, OOP was relatively simple. It made sense in the context it was introduced. I loved it.

In the decades that followed, a feature on top of feature came, and OOP became complex: enhancements that took a long time just to understand why and under what circumstances you might need them; not to mention layers of abstraction that slow down performance and are difficult to read and understand. And unintended side effects became more difficult to track - a concept of object/class became inflexible and started to control everything, as opposed to being driven by what the user needs.

IMHO, functional and declarative programming is the future: it's better in terms of describing reality (focused on actions by users, as opposed to object-focused), especially when it comes to services, network computing and complex systems that are user-driven and change often.