Disclaimer: I'm using C# for code examples. But I guess they should be readable/understandable for everyone. If they are not: please leave a comment.
Okay I have a Client-Server application. The server can be extended with Agents. An agent can be used to distribute loads.
An Agent should have some static variables like ID etc. All of these values will be self-generated (ex.: ID = Guid.NewGuid(). The ID should be once set and always be the same. Even if you restart the Agent.
My first thought was I want to have some kind of Config class which contains these variables.
class Config
{
public Guid ID { get; private set; }
// ...
}
Okay when an Agent starts it should check IsConfigurationInitialized. If its not, initialize it.
I thought it would be an neat idea not to care about the initalization of the configuration. So the configuration itself check in the constructor if it needs to be initalized. So my main path of the application just do something like Config config = new Config();
But for some reason I feel like this is a bad idea since the class is just a variable holder.
To my question:
Does the above given example break the SOC or any other design principle?
Aucun commentaire:
Enregistrer un commentaire