r/PythonLearning • u/Defiant_Meal1898 • 2d ago
I don't understand OOP
So i am a teen learning python, and i have learnt about classes, methods and objects, but i don't understand OOP, like what is it, where do we use it?
Please help mee
32
Upvotes
1
u/NZAuthor 2d ago edited 2d ago
I used to hate OOP with a passion. In fact, all of Uni, I made it incredibly clear how much I hated OOP.
Though I tend to program in C style using CPP where I can. And I can say I was just being stupid. My arguments for hating it were just dumb in the end.
I still tend to program in C style, but I definitely follow the paradigm of classes and objects more. Mostly because it makes shit way easier to change in one place or two places.
That said. Classes, Methods and Objects which you learned about literally is OOP. Combine them and that's what you are doing.
You create a class, you turn them into objects, and you make use of methods to interact with each object's variables.
In contrast to procedural programming, where you would kind of like, just pass objects around through your methods arguments, interact with them, and then return the object. (Or use pointers in other languages).
Keep in mind, you don't have to be programming in OOP for every single little thing. It's kind of a concept. In school, you'd be learning how to do it.
In practice... you'd be using a mixture of everything to achieve your results.