I now trying to get rid of god objects from my server code.
At first of my server design, I decided to do World
, and const
containers objects as singleton.
But my server is multithreaded, and singletons there aren't good solution.
So I managed it and I moved that classes as Core
class instance.
For example:
class Core
{
...
private:
World world;
CExpTable exptable;
...
};
Core
on new connection is giving references to object for Session
class.
new Session(io_pool.getService(), world, exptable ...);
I need only one instance of that objects. But god object is bad design pattern, so I would to ask, how I can redesign that object, to avoid it, and is singleton pattern design good?