• Advertisement
Sign in to follow this  

Over complicating for learning...bad?

This topic is 4155 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm writing a simple Pong game, as hopefully my first game that I can actually complete.(yay for endless list of orpg wannabe) Anywho, for my pong game, I over complicated things for learning purposes. Such as, making a Ball class, Paddle class, I might even make a GameManager class later. So my question is, is it bad to over complicate like this or is this how a game this simple should be programmed? This is C++ BTW.

Share this post


Link to post
Share on other sites
Advertisement
I see these sort of questions often; I'll try to answer this clearly.

Do you want to learn C++, or do you want to learn how to make a simple game? You have to make that dinstinct choice, because writing *proper* object-oriented code (cohesive, without anything that will break the design) takes a lot of reading and a lot of practice.

The bottom line is, you don't *need* to use classes or design your game around objects whatsoever; especially for something this minute. It might be good practice, but for a beginner I don't think its a very good idea.

So then; I suggest you pick a simple game library like SDL or Pygame(uses Python really, but good practice) and see how that goes.


(I wonder what causes people to jump into OOP from the get go?)

Share this post


Link to post
Share on other sites
If you're doing it to learn/practice using classes and other associated language features it's perfectly fine; the relative simplicity will probably allow you to develop an understanding of how they work without forcing too much complexity on you.

However, there's also something to be said for writing good clean code, and making the code unneccesarily complex for learning purposes can be bad for that if you don't at some point learn to stop doing it.


By all means use features that aren't neccesarily required if you need the practice, but make sure you use them well, and if you actually want to produce a good final product rather than simply discarding it after learning you might want to do some rewriting to remove anything unnessesary; the practice at refactoring your code would probably be good for you in the long run anyway. [smile]

Hope that helps.

Share this post


Link to post
Share on other sites
Learning how to program also includes learning how not to program. By making things baroque you get a chance to learn first-hand at what point the architecture of your code becomes a serious hindrance. And it gives your C++ knowledge a good workout.

But beyond that: K.I.S.S., and beware creeping featurism.

Share this post


Link to post
Share on other sites
I don't think that assigning each element of the pong game a class is overcomplicated.
If it does something than ease up your code, train your understanding on how OOP works.
This is the right course, everything else would be just a C hack, not C++ programming.

You will notice when you overuse classes very clearly, as long as you keep in mind that classes represent data structures and hold methods to work on that same data structures. If you see that the class isn't really a data structure but just a compilation of methods on different objects, you should rethink your design.

To cut is short, I you will more likely use "not enough" classes than too many, as long as you keep the purpose of those in mind.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement