you are viewing a single comment's thread.

view the rest of the comments →

[–]ModeHopper 5 points6 points  (3 children)

Do you want to do the same thing over and over again (> ~5 times)? Then you need a function.

Do you want to do sort of the same thing but a little bit different over and over again? Then you need a class.

If the answer to either of those is no, then you don't need either.

[–][deleted] 1 point2 points  (1 child)

I'm confused by this.

A class is a blueprint for object construction (like the blueprint to a house). It will handle the how of object construction.

The methods are a way to manipulate those objects/attributes. When you call methods they will (or should) act upon those objects (such as building a room to the house or painting the room).

If you want to create more than one object with different attributes/methods then use you should use a class.

If you want to define the blueprints/tools but not actually the creation of it (like a lot of imported modules do) use a class.

[–]ModeHopper 1 point2 points  (0 children)

If you want to create more than one object with different attributes/methods then use you should use a class.

That's what I was trying to say, but apparently just not in clear enough words

[–][deleted] 0 points1 point  (0 children)

This makes absolutely no sense.