Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid private fields naming guidelines are ok?
    primarykey
    data
    text
    <p>Here <a href="http://source.android.com/source/code-style.html#follow-field-naming-conventions" rel="nofollow noreferrer">http://source.android.com/source/code-style.html#follow-field-naming-conventions</a> it is stated that :</p> <blockquote> <p>Field Names</p> <ul> <li>Non-public, non-static field names start with m. </li> <li>Static field names start with s. </li> <li>Other fields start with a lower case letter. </li> <li>Public static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES.</li> </ul> </blockquote> <p>It also states that :</p> <blockquote> <p>The rules below are not guidelines or recommendations, but strict rules. You may not disregard the rules we list below except as approved on a need-to-use basis.</p> </blockquote> <p>I don't like the "m" convention before private or package fields in a class. I really find this uninspired... I mean, if we try to apply good designs, the low coupling of the classes implies having few public fields. actually, in my programs I usually have no public fields, even when I need some I use getters and setters... </p> <p>So, why should I be forced to have almost all my fields in the program with an "m" in front of them? wouldn't be easier to have the few public fields, if there are any, with some "g" in front or something? or just use setters and getters as beans suggest? this really makes my code harder to read.... </p> <p>Also, following these guidelines, local temp variables used in the methods have no restriction so they could easily be mistaken for public global fields (also without restriction)... this also I find to be wrong, as it is a probable source of mistakes... I understand to have a way of differentiating from fields, but private/protected member fields are the most used in an application, they shouldn't be less "readable".</p> <p>What do you think? Should I follow the guidelines?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload