So I've got about 1/4th of my engine up and running using the GCC4 code base as the back bone, but last night I hit what is considered a code smell in c# / web development as I realized a lot of dependencies were being pulled from global variables.
I had planned on forking my code base and re-factoring it to inject dependencies through client class' constructors / init methods as opposed to allowing them to grab dependencies from public properties off the global application object but I'm sure there's got to be a reason why you guys did it this way, just not sure what it is yet...
An example would be to extract an interface from the ResCache and inject a weak pointer to this interface into the GameCode4_Hlsl_VertexShader as opposed to allowing it to grab a ResCache from the g_pApp object in order to retrieve the hlsl file.
(Disclaimer: I'm new to c++ so maybe the answer is trivial and my noobness is keeping me from seeing it so I apologize if this is the case :))
Interested to hear other peeps take on this.
Thanks!
I had planned on forking my code base and re-factoring it to inject dependencies through client class' constructors / init methods as opposed to allowing them to grab dependencies from public properties off the global application object but I'm sure there's got to be a reason why you guys did it this way, just not sure what it is yet...
An example would be to extract an interface from the ResCache and inject a weak pointer to this interface into the GameCode4_Hlsl_VertexShader as opposed to allowing it to grab a ResCache from the g_pApp object in order to retrieve the hlsl file.
(Disclaimer: I'm new to c++ so maybe the answer is trivial and my noobness is keeping me from seeing it so I apologize if this is the case :))
Interested to hear other peeps take on this.
Thanks!
-bullgoose
The post was edited 1 time, last by bullgoose311 ().