Hello, everyone!
I need to find a good and understandable naming-scheme for routines which deal with "value arrays" (I've written something similar to C++'s valarray
in Java, with some optimizations for primitive types in mind).
I know that the main categorization of routines is made between:
- functions (they may take parameters and must return something)
- methods (they may take parameters and don't return anything)
For performance reasons, I allow to define not only functions/methods which threat their parameters as readonly, but also functions/methods which may modify their first parameter.
So that one can not only do this... :
ValArrayInt a=..., b=...;
// "apply" treats "a" and "b" as readonly
ValArrayInt temp = ValArrays.apply(adder, a, b); // temp = a + b
a = temp;
... but also this:
ValArrayInt a=..., b=...;
// "apply" modifies "a"
a.apply(adder, b); // a += b
Please, suggest a naming scheme for these kinds of routines:
- functions which treat all parameters as readonly
- functions which may modify their first parameter
- methods which treat all parameters as readonly
- methods which may modify their first parameter
I have thought of something like ModifyingMethod, NonModifyingMethod, or similar, but I think those names are not straightforward enough, and too long.