Quantcast
Channel: Overhead of using big singleton with all files includes - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 3

Overhead of using big singleton with all files includes

$
0
0

I have several subsystem managers for various uses, for example:

AudioManagerCollisionManagerInputManageretc.

At first I wanted them to be all singletons, however now want to make the architecture a little bit cleaner. The main idea is to use only one big singleton (for example System) and it will contain all of these objects.

So interaction would be like this :

System::getAudioManager()->playSound("Explosion");//Before it was like this// AudioManager::playSound("Explosion");

However, now classes who need to use these "managers" must get access to the instance of the actual class, with singletons I would use just an include to a file which is needed:

#include "AudioManager.hpp"

Now I have to make this:

#include "System.hpp"

It means that I have to include the main singleton file which contains all the includes, all the other subsystems created and used. Does it have some overhead (performance) or cons?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images