Good programming style when handling multiple objects

Posted by Glitch on Stack Overflow See other posts from Stack Overflow or by Glitch
Published on 2010-04-23T15:23:16Z Indexed on 2010/04/23 15:33 UTC
Read the original article Hit count: 286

I've been programming a software version of a board game. Thus far I have written the classes which will correspond to physical objects on the game board. I'm well into writing the program logic, however I've found that many of the logic classes require access to the same objects.

At first I was passing the appropriate objects to methods as they were called, but this was getting very tedious, particularly when the methods required many objects to perform their tasks. To solve this, I created a class which initialises and stores all the objects I need. This allows me to access an object from any class by calling Assets.dice(), for example.

But now that I've thought about it, this doesn't seem right. This is why I'm here, I fear that I've created some sort of god class. Is this fear unfounded, or have I created a recipe for disaster?

© Stack Overflow or respective owner

Related posts about java

Related posts about objects