New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSGObject: Making *io, *parallel, *version singletons #2112
Comments
@karlnapf - According to the principle of "seperation of concerns" this is a good idea. If the singletons are immutable, this is a very good idea, because it's indeed just encapsulating global data. (Using global variables would be fine as well. ;)) The the variables are mutable (like random or parameter framework), we'll get problem with threads. If you're really trying to put this stuff into singletons, then please make a first draft and lets check if it's obfuscating the code too much. |
Asking simple questions:
|
As @lisitsyn pointed out, the drawback of singletons are that you only have one. So we'll never be able again to run multiple shoguns! |
I agree, drafting is very important for this! I guess one first step would also be to wait for @sonney2k comments since he wrote all this stuff (and he usually does not do things without having some thoughts) Some of my thoughts:
|
We can avoid storing IO, parallel and other things by adding some level of indirection here, which just aggregates these helper instances, like:
|
@lisitsyn - are you talking about adding more classes to the hierarchy? We tried this (see SGRefObject and SGRefObjectArray) for improving the label classes but we (I?) got stuck somehow... The problem is here, that we depend on SGObject everywhere and we need to touch every place (and possibly duplicate classes) to make it work for SGRefObjects as well. Or did I miss your point? What do these arrows mean? |
No, I just mean if we have multiple things composed with SGObject (SGIO, blabla) it makes sense to add an another layer here that composes all the helper classes. This way SGObject would have just one member, some SGContext or whatever you call it. |
@lisitsyn, Lets call it Have a look on the CSGObject class: We have methods |
@tklein23 I think it decreases coupling so should be better |
@karlnapf wrote:
@lambday I agree wiht you, singelton is a way cleaner concept than global variables. In fact, why not transition all of the global ones (IO, etc) to singleton? Any thoughts on that?
@lisitsyn @vigsterkr @sonney2k @iglesias ?
The text was updated successfully, but these errors were encountered: