Naming
Despite the move to classes and object-orientation, not much has changed about how things are named. As before, types are prefixed with “a” or “an,” while formal arguments are prefixed with “the.” You can see how this makes it easy to understand the scope, source, and life span of variables and their content, and to distinguish a class declaration from an instance of the class.
In addition, use of the prefix “my” is continued, but in a slightly different context.
In the procedural Accumulator() function, myAccumulator was a static local variable whose life span was the same as the program. It provided Accumulator() with internal state and made it more like an object. In the case of classes, the prefix “my” is used for member variables, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access