Should I put global application details in a static class?
I'm currently maintaining a legacy C++ application which has put all the global application details in a static class, some of the variables stored are:
- application name
- registry path
- version number
- company name e开发者_高级运维tc..
What is the recommended method for storing and accessing system application details?
If it never changes then why not. However, if not I'd externalise it into data that's loaded at run time. This way it can change without rebuild.
And since you include version number, I'd suspect the latter is way to go.
From my C++ days I recall builds taking not inconsequential times.
I'd rather use a namespace if no instances of the class will be created.
no hurt, and I think to use a singleton is even better.
精彩评论