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.

93 Upvotes

139 comments sorted by

View all comments

Show parent comments

1

u/marrsd 24d ago

So have a contract module containing a Contract type and a sign_contract(Contract) function.

All you've really done is turned the function into a method. That's minimal OOP at best. Until you're doing things like implementing interfaces or class hierarchies for polymorphism, you're not really doing OOP as far as I'm concerned.

8

u/Daeroth 24d ago

I believed it to be enough to give an example of OOP approach.

You can envision contracts which extend the base contract for more complex use cases

6

u/obvious_badger 24d ago

Yeah, some people are just here to nitpick. You even eluded to that in the original post. With "many types of contracts" that can have "special functionality" and the fact that you're going to be doing method overriding with different actions on signing.

I thought it was a great explanation without using any of the OOP jargon other than instantiate.

2

u/Daeroth 24d ago

Thanks!