The most important thing when starting to program like this, is separating responsibilities clearly over your different objects. The only object that can make the Item visible on a panel, is the Item itself. Therefore you need to create a method in the Item "class" (I name each separate object in a file a class, but I'm still waiting for Lite-C to introduce the real deal with classes!!) to visualize the Item (item_visualize()). You may then call this function from every other "class" that uses an Item. If you, for example, start assigning an Item bitmap to a panel bitmap in a different class without calling the item_visualize() function, you'd get a big mess very soon.

Create responsibilities only where they apply, and only perform calls on those responsibilities in parental "classes", never start fiddling with the parameters and logic-functions from other classes outside the class itself.

Mind you, there are a lot of different ways to distribute responsibilities. Those 'ways' are called Design Patterns. The one I represented is just one way, but there are many more. If you know them well, you can easily make maintainable, extendible and overviewable source code.

Last edited by Joozey; 07/09/09 12:46.

Click and join the 3dgs irc community!
Room: #3dgs