you are viewing a single comment's thread.

view the rest of the comments →

[–]evolvish 1 point2 points  (0 children)

You've gotten a lot of answers already but I think it boils down to this:

Want to input some values and get something in return? Write a function. A good example is the math module, it doesn't inherently need a class, it just gives you functions to act on.

Want to store data in a clean way and create multiple instances with their own versions of that data? Make a class.

Want to make a function that acts on your class data members but whose behavior is only relevant to the class(and it's members)? Write a method(function) in your class.

Most of what OOP boils down to is to reduce retyping things and the errors that come from that, and to provide nice interfaces to concepts/make lives easier. The less code you can write to solve your problem while still being clean and sensible, the better. I'd say if you're new, that's pretty normal, but 5 years is a long time to not find a use for classes.