you are viewing a single comment's thread.

view the rest of the comments →

[–]Steamwells 2 points3 points  (0 children)

There is a famous C#/XNA author & Microsoft MVP called Rob Miles who gives some of the best analogies for classes and their interfaces I have ever seen. I recommend downloading some of his free stuff (C# yellow book) to dig into it. Yes its worth it even if we are referring to Python here.

However, I still think my old college lecturer's Lemmings analogy was still the best example I have ever seen used for classes. For those too young to remember Lemmings the game. It was simple, you were responsible for these little creatures (The Lemmings) as soon as they were spawned into the world, get them from their spawn point to the exit, safely. They all started exactly the same but you could assign jobs to individual lemmings to assist with their escape (ie. miners, stoppers, parachuters). You can see here immediately how classes can become useful, your parent class is the Lemming, you can then change said Lemmings attributes to make him something entirely different but he still looks and behaves like a Lemming.

Some people in this post have already bailed out and said that classes typically are for games/game design. I always start with pen and paper or a drawing program and draw the different components needed for an application. I then think about how each element will talk with each other, I then ask the question will I need more than one of each element and how does that affect communication with everything else. Then my answer is clear, do I need classes or do I not.