Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (2014) Improving Our Code Dynamically Changing the Background Color

Jeff Walker
Jeff Walker
2,454 Points

Correct me if I am wrong but I do not believe the naming convention of mVariable is used in Java. Other languages yes.

I have been coding in Java for many years and the mVariable type of naming convention has never been an accepted standard anywhere I have worked. You see this in other languages but not Java. The standard has always been myVariable with no indication of variable type ( local, member, etc ). Has something changed?

3 Answers

Jeff,

This convention is more common and recommended for Android development, but I have not seen it in standard Java development. Android Studio understands the convention and it can be useful to use. Ultimately, it's all preference.

Jeff Walker
Jeff Walker
2,454 Points

Cool. Thank you very much for the info.

Kyle Salisbury
seal-mask
.a{fill-rule:evenodd;}techdegree
Kyle Salisbury
Full Stack JavaScript Techdegree Student 16,363 Points

The Java instructor Craig in the Java Tracks uses it, but he admits that he is not a true Java developer. He does mainly Python I think.

Gavin Ralston
Gavin Ralston
28,770 Points

The Android Code Style Guide might help you make more sense of the convention. It goes beyond just "m is for member" and makes more sense out of it. singletons and constants being instantly recognizable, and you don't have to fill your source with this in order to be very clear about the variable's membership.