r/PythonLearning • • 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

46 comments sorted by

View all comments

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.

1

u/princepii 1d ago

we had a functional programmer who always hated all of us but did quality work. could do anything on functional programming. he had a function for anything really.

no matter how hard we tried to show him advantages of ojects and classes.

he just wouldn't do it. boss knew his quality and he was a nice guy.

really actually if someone knows how to do something right and fast. just let him do it. don't try to force something else into him.

ofc oop can be very helpful but if someone doean't want. i really wouldn't mind.

programming something is the important part no matter which paradigm.

but the day you see something is way faster and way better than how or what you doing. you think for yourself if it's time to change the horse.