Hello!

I want to know about the rules of naming fields in the "Android". I read the article Code Style Guidelines for Contributors . He stopped at the naming of fields, decided to move away from the usual ways to write code in the project on the "guideline". I can not get used. The code has become less readable, annoying prefixes to variable names, the lack of this in constructors.

How justified is the use of this agreement?

When the development environment itself helps to understand what we see?

Would not it be considered that the code written ignoring this standard is not of high quality?

// Этот класс взят из вышеупомянутой статьи public class MyClass { public static final int SOME_CONSTANT = 42; public int publicField; private static MyClass sSingleton; int mPackagePrivate; private int mPrivate; protected int mProtected; } 

The constructor now looks like this:

 class MyClass(Context context, TextView textView){ mContext = context; mTextView = textView; } 

instead

 class MyClass(Context context, TextView textView){ this.context = context; // глазам приятно видеть this this.textView = textView; } 

The code is cumbersome:

 private TextView mTextView; mTextView = mRootView.findViewById(R.id.tv_new_text_view); 

Instead:

 private TextView textView; textView = rootView.findViewById(R.id.tv_new_text_view); 

Do you use this agreement in your projects?

How do they treat or ignore this agreement in large companies?

How does “google” refer to ignoring this convention?

Closed due to the fact that the participants are off-topic Vladimir Glinskikh , Mirdin , Nick Volynkin , aleksandr barakin , user26699 Jul 25 '15 at 9:17 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • " Questionnaires are forbidden on Stack Overflow in Russian . To get an answer, rephrase your question so that it can be given an unambiguously correct answer." - Vladimir Glinskikh, Mirdin, Nick Volynkin, aleksandr barakin, Community Spirit
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    Unfortunately, this is offtop on SO. Questionnaires are prohibited ... - Vladyslav Matviienko
  • one
    The answer to this question depends on the opinion. That is, there is no right answer to it. Such questions cannot be asked here ... I personally rotated these guidelines on the drum, I don’t like them, I don’t use them. - Vladyslav Matviienko
  • 2
    If you use the rules adopted in the agreement, other developers will thank you for it. Separating class field names from local variables with a small letter m (or s for static ones) is a great convenience in terms of readability of the code, you quickly get used to it and then curse all lovers of home-grown amateur writing spells for a long time. You cannot be forced to follow this agreement, but it is, firstly, suffered by the pain in the eyes of thousands of those who were before you, and secondly, your professional level is often better than a resume (in which you can compose everyone) - pavlofff
  • one
    and .. and yes, Google is not at all interested in how you write your code there - they don’t read it. And these agreements are not Android-development, but Java in general. That is, when developing on some Golang (or C ++) for android, you must adhere to the agreements for the language you write, otherwise Sishniki will not understand you with these Java conventions. In general, these are recommendations - you can write as you like, but if you follow the agreements, this is how to write correctly. Do you like reading an illiterate text? - pavlofff
  • one
    @pavlofff, by the way at the expense of the Java agreement, and not the android development, where you can see it? Oracle didn't see anything like this in the examples oracle.com/technetwork/java/javase/documentation/… - Garf1eld

0