Hungarian notation in Android naming conventions
So, I’m not a super fan of Hungarian Notation Hungarian notation. Today one of my Android developers went offline this link cites official advice on Android development, and to my surprise, they found it useful to start all field names with
In my opinion, the only case where these
mSomeField names might be useful is when there is no code highlighting, in which case it’s easier to see which variables are local and which aren’t. But now any IDE can display this, right? So, why do the latest Android code need these rules and conventions?
Update: Well, my bad, it looks like these suggestions are for contributors (which makes sense in this case, they want to keep the same coding way). Anyway, I’ve been told that this is often used in Android projects. If so, the problem lies in those projects.
You must ask the original developer who set the standard for the project. 🙂 This is purely my guess, but when you consider that Android is built on Linux and has quite a bit of C/C++ code in it, I think choosing to use Hungarian notation is just old-school C++ influences creeping into the Java side of the codebase. This is unfortunate in the modern world of IDEs, and it seems to me that the need for it is a bit “code flavor”.