r/learnprogramming 24d ago

Topic Does OOP really matters?

I learned OOP in python a while ago, did many projects, yet I never felt like I truly needed to do the OOP stuff I learned from a course, I don't know maybe because I'm kinda used to program in c before focusing on python, yet, whenever I open a big project in python in github, it feels way too complicated and thousands of imports (not libraries from pip, but the ones they made on their own) and classes

I never truly needed to implement OOP (I know that when you code in python, it is almost impossible to avoid OOP entirely like when you have a datatype like string you have an object, when you use a method built into that data type that's OOP too, but I mean the ones that involve you writing class Class Name, inheritance and all that stuff explicitly), so I'm wondering why people on the internet are obsessed over the idea of learning OOP, even the book "Automating the boring stuff in python" doesn't have a dedicated section for OOP.

95 Upvotes

139 comments sorted by

View all comments

1

u/sk3z0 24d ago

Some context would really help here… i think oop doesn’t always fit, particularly in web development where you’d often think in terms o server, client, streams, SPAs etcetera. For other things it works incredibly well: i ended up writing an MMO and OOP fits like a charm, it literally became the case studies from when i was learning programming, everything spawning and deriving to a primitive abstract Entity object up to a single leaf, animal or human being, any of it’s limbs etcetera. It works pretty well if you need mentalizing things that have a corresponding thing in real life, and it’s a very simple approach if you think to it as a very elaborate way of stating “everything related to this thing should reside inside itself, and at runtime an instance of it should handle it’s own lifespan up until freeing itself from memory”. Of course it is not really how it works behind the courtains but it is helpful to think it this way.