3 ms·
Correct, but the effectiveness of the design is separate from its correctness. Latter of which is what I commented on. For effectiveness, I think it reduces an
by jvanderbot 7y ago
Correct, but the effectiveness of the design is separate from its correctness. Latter of which is what I commented on.
For effectiveness, I think it reduces ancillary class members, and encourages (necessitates!) dependency injection.
For example, changing "delta t" in a game object update is trivial: update the one delta-t you have, and pass it into everything that needs it. With classes, there may be a temptation to have a delta-t member variable, which costs many updates. Stupid example, but a mistake which is not possible with Dependency Injection.
But really, proper scoping in typed languages (and naming in dynamic ones) can allude to input vs output parameters. In C/C++ this is passing by ref vs value. (In Google C++ style guide, they recommend use of pointers for "adjusted" or "output" parameters.) In MS C++ from back in the day, I think they had ways to explicitly specify parameters as input, output, or input+output. Does someone have an example of this?