4 ms·
Yes, but looking at the function, and banning some project specific naming convention, there is no way to know its role is to mutate a state. While in Python,
by BiteCode_dev 7y ago
Yes, but looking at the function, and banning some project specific naming convention, there is no way to know its role is to mutate a state.
While in Python, when you see a class, you just know the methods are mostly about "self".
It helps making sense of the code immensely.
- jvanderbot 7y agoCorrect, 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?
- bhandziuk 7y agoplus favoring mutability over immutability opens up a whole other can of bugs