Well, the obvious answer is to name the parameters for what they
are: initialX
and initialY
(or in setters, newX
and
newY
). Following this logic, the member variables should
probably be currentX
and currentY
—the usual rule is
that variable names should be qualified nouns.
Which is all nice in theory. In practice, it seems that the
above might be overkill (or a too rigorous application of the
theory). At least, every where I've worked, there's been
a convention about naming members, so that one can immediately
see whether a name is a member or not. Ideally, it shouldn't be
necessary, but practically, we don't work in an ideal world.
The two most common conventions I've seen are m_
or my
as
prefixes for the member names (with s_
or our
for static
members). The other widespread conventions (using an underscore
as prefix or suffix) should be avoided, because leading and
trailing underscores aren't very visible, and make the code hard
to read. (Leading underscores also tend to be used for very
special symbols in the implementation, and should be especially
avoided.)