Timeline for Should I use mMember and sStatic naming convention in Android?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 19, 2016 at 19:12 | comment | added | Konrad Morawski | And I'm not even saying there's no correlation between the bugs ratio and the convention. Since it's more dated, I'd expect it to be followed more often in old codebases that have reached maturity longer ago. This would be sort of circumstantial though and doesn't indicate this is good practice. | |
| Oct 19, 2016 at 19:02 | comment | added | Konrad Morawski | I don't know why one would dismiss Google's modern style guide as non-mainstream, and it's a bit of a stretch to imply that memory leaks in Google Maps are a result of not using "m" prefixes in the codebase, unless you have something to substantiate this allegation. For all I know they may actually be used over there, and then what :) Because Google isn't 100% consistent, e.g. the prefixes are prevalent in Android SDK sources (I see that as a legacy thing). We may disagree on that, but it's good to expose beginners to differing points of view so they can make their own mind. | |
| Oct 17, 2016 at 18:38 | comment | added | Kevin Krumwiede | @KonradMorawski I'm proposing that adherence to mainstream conventions correlates strongly with code quality. I'm not proposing a causal relationship between these things, of course; I think both are the result of experience. And there are certainly variations in conventions at large companies. But Google's bucking of convention is an example of the correlation I'm talking about. They seem to be completely clueless about how to manage issues, many Android APIs show signs of very little thought having gone into them, and the Google Maps API team doesn't know how to identify a memory leak. | |
| Oct 17, 2016 at 11:18 | comment | added | Konrad Morawski | "not abiding by Java naming conventions immediately flags you to your peers as not a real Java programmer..." - that's a really blunt statement Kevin. Which naming conventions? For instance Google style guide explicitly says it's a no-no, see google.github.io/styleguide/javaguide.html "In Google Style special prefixes or suffixes, like those seen in the examples name_, mName, s_name and kName, are not used". | |
| Oct 17, 2016 at 11:16 | comment | added | Konrad Morawski | @Lovis as an Android dev, I've worked with codebases that use it. I believe it's much more common in enterprise Java, but that's hardly a recommendation. In fact you can see it in Android SDK source code - although that's a legacy thing in my view and not an example to follow. Personally I don't like the convention and agree with your argument: this prefix is just a painkiller. It's easier to take it than to tackle the real cause of the pain (typically overly complex codebase). | |
| Feb 16, 2015 at 7:37 | comment | added | Lovis | But I don't have 15 years of experience yet, so I might still see one someday. ;-) | |
| Feb 16, 2015 at 7:35 | comment | added | Lovis | No java/android Dev I ever worked with used the m* convention. Some used an underscore, but for me the whole point is, that your classes and methods shouldn't be so big that you can't tell the difference between a member and a local at the first glance. | |
| Feb 16, 2015 at 4:37 | history | answered | Kevin Krumwiede | CC BY-SA 3.0 |