Where/how to use classes

In the few games I have made, my classes are quite jumbled and unordered. I see alot of classes in open source projects that I wouldn’t have thought of creating such as an entity class. The way I made my entities was by declaring a new player class.

Is there any advice on this or do you just learn over time?

Thanks,
Kieran Newland

My suggestion is to read some kind of object-oriented programming tutorial about when to create a class for something and when to create abstract classes/interfaces etc.

If you find something very strange or seemingly unneccessary in any of those tutorials, you probably need more practial experience. Try to build systems and see why they become practical/not practical to expand, maintain, understand etc.

When you get more experience you might want to read about design patterns and other software theory.

For every “rule” about software engineering there is usually a very good reason but sometimes you have to actually experience it yourself first and learn the “hard way”. I have built and designed many crappy systems that became a nightmare to understand, maintain and expand :), but each time I have learned a lot.

Thanks for the advice. Ill be sure to do what you have suggested.

Thanks,
Kieran Newland

To put it rude, you need to cretae a class when there is something with certain attributes and behaviours so you can “command” it and let it expand by inheritance. However of course krasse’s sugestion must be done :smiley: