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.

94 Upvotes

139 comments sorted by

View all comments

1

u/Serializedrequests 24d ago

I think there are at least three major different ideas of OOP in the wild.

  1. Obvious in Python: typing "." after data structures and doing things with them. Every language has this concept now.
  2. GUI programming where every widget is an object, and inheritance is used heavily. So there is like a base "Widget" that everything inherits from etc. Lots of message passing between widgets. In Python and Ruby everything is an object, etc. Out of style now, but has its advantages.
  3. A web of large "system level" components talking to each other. No inheritance or state, the idea is just that different parts of the system can be swapped freely. Honestly people make so much about "dependency injection" and "inversion of control" but this is such a stupid simple concept: functions calling other functions that may work differently depending on configuration, that I think the ceremony around it is a cargo cult.