digsy wrote:I just want to get an idea of how to design my code in a clean way that will allow me to avoid complications down the road.
Depending on who you ask, that is the Most Important Thing a Program Should Do. To them, being able to modify things easily in the future is more important than that it "works". (Because if you are able to modify it easily, you should be able to modify it so "it works").
It is also a bit like the Holy Grail of programming - because most of the time you don't know what waits "down the road", you can not
really prepare the code in advance. You always find something that you didn't foresee.
So the first thing to do is accepting that complications will happen. Not everything is lost, however; you can't
avoid them, but you can
minimize their impact, which is nice.
There are lots resources on how to achieve this, but this greatly enters the realm of personal preference, and intense religious battles on internet forums.
Here are my favorite
non-free resources:
Here are some of my favorite free resources:
- Ruby - after 1 year programming on this language, your code will just be more prepared for the future - even if it's not Ruby!
- stackoverflow.com - If you are not sure about how to implement something, ask here. If you invest a bit of time in the question, you will get a very good answer in very little time.
- The 5 letters of SOLID
Those are for programming in general. For games, Chris Hargrove's
Code on The Cob, Part 1 (Especially the bit right after "Pandora's Boxes") describes the gist of it: basically, make sure that your code is "isolated in closed boxes" with as little as possible "communication" happening between them as possible (That's a mixture of S and O of SOLID).
Regards!