[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [handly-dev] A better naming convention for model *Impl* interface methods?
|
OK! Thanks, Vlad!
Thinking a bit more about it, our case is indeed special in that, to avoid name clashes with a user-defined method, we have to go
against the commonly used naming guidelines, such as those recommended by Oracle (Sun) or Google. For example, Google Java Style Guide says that
special prefixes or suffixes, like those seen in the examples name_
, mName
, s_name
and kName
, are not used (https://google.github.io/styleguide/javaguide.html#s5-naming). However, we do need a special prefix (or suffix), which puts us in a grey area stylistically.
Regarding underscores, the Java Language Specification states that
The "Java letters" include uppercase and lowercase ASCII Latin letters A-Z (\u0041- \u005a), and a-z (\u0061-\u007a), and, for historical reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $ sign should be used only in mechanically generated source code or, rarely, to access pre-existing names on legacy systems.
So, it seems that only the $ sign is reserved for special purposes; there is no such provision for underscores.
Also, the Sun naming guidelines state that
Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed.
However, I have found a clarification that
This is in contrast to other coding conventions that state that underscores should be used to prefix all instance variables.
So, this looks like solely a matter of style to me. I have found no technical reasons for not using the underscore as a special prefix.
Speaking stylistically, I remain undecided and would appreciate further votes/comments.
Thanks!
Vladimir
Hi,
I meant that underscores work for me, I think it's a bit more readable. But I have no problem with the h prefix either.
Regards,
Vlad