Quote Originally Posted by Akkernight View Post
Well, I cleaned the code up a load, and now it works ^^
I learnt something from it atleast I must remember to try to keep the code as clean as possible ^^
That's the point of Salem's post: You should DESIGN your classes such that you understand what depends on what.

There are some different ways to come up with a design, many books and even more PhD thesis' have been written on the subject. But the basics of it is pretty simple:
1. Figure out what data and functions you need to have to solve a particular problem (or part of the problem).
2. Figure out how the different data items and functions interact.
3. Make up classes that contain data that belong together, and add functions that "make sense".

It is often best to try to be minimalist in class and function design - but of course, a class/function should add some value to the overall program - if it doesn't, then it's probably "too small".

[Of course, if you read a design class/book, you'll find that it takes 200-500 pages to describe the above, with many examples and a lot more detail - because you wouldn't be able to sell a book that is only half a page! ].

--
Mats