[android-developers] Re: What does the prefix 'm' stand for ?
that's a *great* feature. There is an option in Eclipse to force the use of 'this.' for members. I have that option set and don't use the prefix. -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: What does the prefix 'm' stand for ?
I don't buy that argument since since all of the core classes in Java are written without prefixes of any kind, and many of the classes were implemented before IDEs became popular. I do also think that the convention would have been added to the Code Conventions for the Java Programming Language (http://java.sun.com/docs/codeconv/html/ CodeConvTOC.doc.html) if Sun thought that it added some great value. One thing that I have observed (it could be 100% wrong, but it's based on reading Java code since the language was released in 1996) is that most people who think they need prefixes and odd conventions write too long methods, or too complex logic, and often in combination with classes that are doing more than one thing. There's not need of prefixing if your methods are short and easy to read (IMHO). On 22 Feb, 17:05, Romain Guy romain...@android.com wrote: I myself am not fond of prefixes, especially since languages like Java already have this. when you need to distinguish local vars vs members. Also, modern IDEs highlight fields differently from local variables. It does make sense however on a project like Android where not everybody is necessarily using an IDE. And it's just a coding convention :) On Sun, Feb 21, 2010 at 10:20 PM, Frank Weiss fewe...@gmail.com wrote: I'm one of those guys who think scope prefixes, like m, are more trouble than they're worth. The fact that you had to explain it to a newbie makes me smile. On Sun, Feb 21, 2010 at 10:04 PM, Romain Guy romain...@android.com wrote: It stands for member. I believe the use of an m prefix with MFC has nothing to do with the name MFC either, but rather to identify variables that are class members as opposed to local variables for instance. On Sun, Feb 21, 2010 at 9:52 PM, Christ wutie...@gmail.com wrote: Hi guys, I saw many sample codes that each variable contains the 'm' prefix. I don't know what this m means. I have two-year experience in MFC. Each variable has 'm' prefix to tell you that I'm the one variable of MFC component. (m stands for MFC). So...can anybody answer me this question? Regards, Christ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: What does the prefix 'm' stand for ?
That was a choice made at Sun when they wrote the Java core classes, our choice was to use a prefix. That's all. It's NOT going to change. On Tue, Feb 23, 2010 at 12:07 AM, Kaj Bjurman kaj.bjur...@gmail.com wrote: I don't buy that argument since since all of the core classes in Java are written without prefixes of any kind, and many of the classes were implemented before IDEs became popular. I do also think that the convention would have been added to the Code Conventions for the Java Programming Language (http://java.sun.com/docs/codeconv/html/ CodeConvTOC.doc.html) if Sun thought that it added some great value. One thing that I have observed (it could be 100% wrong, but it's based on reading Java code since the language was released in 1996) is that most people who think they need prefixes and odd conventions write too long methods, or too complex logic, and often in combination with classes that are doing more than one thing. There's not need of prefixing if your methods are short and easy to read (IMHO). On 22 Feb, 17:05, Romain Guy romain...@android.com wrote: I myself am not fond of prefixes, especially since languages like Java already have this. when you need to distinguish local vars vs members. Also, modern IDEs highlight fields differently from local variables. It does make sense however on a project like Android where not everybody is necessarily using an IDE. And it's just a coding convention :) On Sun, Feb 21, 2010 at 10:20 PM, Frank Weiss fewe...@gmail.com wrote: I'm one of those guys who think scope prefixes, like m, are more trouble than they're worth. The fact that you had to explain it to a newbie makes me smile. On Sun, Feb 21, 2010 at 10:04 PM, Romain Guy romain...@android.com wrote: It stands for member. I believe the use of an m prefix with MFC has nothing to do with the name MFC either, but rather to identify variables that are class members as opposed to local variables for instance. On Sun, Feb 21, 2010 at 9:52 PM, Christ wutie...@gmail.com wrote: Hi guys, I saw many sample codes that each variable contains the 'm' prefix. I don't know what this m means. I have two-year experience in MFC. Each variable has 'm' prefix to tell you that I'm the one variable of MFC component. (m stands for MFC). So...can anybody answer me this question? Regards, Christ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to
[android-developers] Re: What does the prefix 'm' stand for ?
Perhaps you should consider that the people who came up with Android's convention had a lot more Java experience under their belt than the people who came up with Java's convention had, way back when. I'm not saying that makes the case, just that your argument-from- authority here falls flat. As for your observation: OK, since you put it that way, I trust you won't take it harshly when I say you're 100% wrong. :) Those of us who write well-factored classes with small methods and clear responsibilities, still have to read code from those who don't. Including a lot of code from Sun; have you read any of their crypto code? It's a convenience, even with short methods. Not having to interrupt your reading and scan up 3 lines to the front of the method to see if it's a local -- or worse, having to search through the file to determine if it is static or instance -- is a convenience. It makes reading the code more efficient. That's all. And at a very low cost, which makes your protests sound strange to my ears. Nothing to protest here, move along now... Now if someone where to claim you are doing something wrong by NOT including prefixes, you'd likewise be justified in suggesting they find better uses for their time. I claim it's not even important for this or many style rules to be applied consistently across a project. I try to stick with the style I find -- and if that varies across a project, it doesn't throw me in the slightest. The only one I get dogmatic about is the tabs/spaces things. Tabs screw things up and make code readable in many environments. Use spaces. End of story. It makes many tools easier to work with if there's rough agreement on indentation amount. Otherwise, arguing about styles is a waste of time, unless you can demonstrate that violating a rule leads to bugs. Yes, I'm aware of the irony of spending time to point that out. On Feb 23, 12:07 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I don't buy that argument since since all of the core classes in Java are written without prefixes of any kind, and many of the classes were implemented before IDEs became popular. I do also think that the convention would have been added to the Code Conventions for the Java Programming Language (http://java.sun.com/docs/codeconv/html/ CodeConvTOC.doc.html) if Sun thought that it added some great value. One thing that I have observed (it could be 100% wrong, but it's based on reading Java code since the language was released in 1996) is that most people who think they need prefixes and odd conventions write too long methods, or too complex logic, and often in combination with classes that are doing more than one thing. There's not need of prefixing if your methods are short and easy to read (IMHO). -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: What does the prefix 'm' stand for ?
There is an option in Eclipse to force the use of 'this.' for members. I have that option set and don't use the prefix. On Feb 23, 12:39 am, Bob Kerns r...@acm.org wrote: I'm not fond of 'this.member'. It seems to combine the worst of both worlds -- an optional prefix that may or may not be used in different places. Though I understand why people use it in setters and constructors to avoid manging their argument names -- real prefixes avoid that need. On Feb 22, 8:05 am, Romain Guy romain...@android.com wrote: I myself am not fond of prefixes, especially since languages like Java already have this. when you need to distinguish local vars vs members. Also, modern IDEs highlight fields differently from local variables. It does make sense however on a project like Android where not everybody is necessarily using an IDE. And it's just a coding convention :)- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: What does the prefix 'm' stand for ?
I like that document, but I'd add a caveat: don't go all gung-ho style police. (I think that fits well with the overall tenor of the document, but is worth being made explicit). The point of style conventions is to make things easier, not provoke arguments. There is, in fact, some benefit from a scope prefix. There is, however, NEGATIVE benefit -- actual harm, from the Hungarian Notation you find in Microsoft's code, which redundantly encodes the PHYSICAL datatype in every usage, impeding maintenance, and often leading to variables declared one way but named a different way. Fields are worth noting, because they're generally declared far away from the point of use. Some use _. I myself use m_, and I continue to do so with Android code, because it nicely separates my variables first in the debugger! I'm not worried about a one-time explanation cost if someone comes along who's never seen the convention. Every serious programmer should read lots of other people's code anyway, so generally people will come across it pretty soon regardless. On Feb 21, 11:04 pm, Sam Dutton sam.dut...@gmail.com wrote: The Android Code Style Guide explains the conventions used for field names:http://source.android.com/submit-patches/code-style-guide#field_names. Sam Dutton On Feb 22, 5:52 am, Christ wutie...@gmail.com wrote: Hi guys, I saw many sample codes that each variable contains the 'm' prefix. I don't know what this m means. I have two-year experience in MFC. Each variable has 'm' prefix to tell you that I'm the one variable of MFC component. (m stands for MFC). So...can anybody answer me this question? Regards, Christ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: What does the prefix 'm' stand for ?
I'm not fond of 'this.member'. It seems to combine the worst of both worlds -- an optional prefix that may or may not be used in different places. Though I understand why people use it in setters and constructors to avoid manging their argument names -- real prefixes avoid that need. On Feb 22, 8:05 am, Romain Guy romain...@android.com wrote: I myself am not fond of prefixes, especially since languages like Java already have this. when you need to distinguish local vars vs members. Also, modern IDEs highlight fields differently from local variables. It does make sense however on a project like Android where not everybody is necessarily using an IDE. And it's just a coding convention :) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: What does the prefix 'm' stand for ?
On Feb 22, 8:05 am, Romain Guy romain...@android.com wrote: I myself am not fond of prefixes, especially since languages like Java already have this. when you need to distinguish local vars vs members. Also, modern IDEs highlight fields differently from local variables. ++ I don't use the m convention either. Other than in constructors where member initialization occurs there is rarely a potential for mix up. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: What does the prefix 'm' stand for ?
On Feb 22, 12:39 am, Bob Kerns r...@acm.org wrote: The point of style conventions is to make things easier, not provoke arguments. It succeeds at both. There is, however, NEGATIVE benefit -- actual harm, from the Hungarian Notation you find in Microsoft's code, which redundantly encodes the PHYSICAL datatype in every usage, impeding maintenance, and often leading to variables declared one way but named a different way. This article is interesting (skip down to I'm Hungary): http://www.joelonsoftware.com/articles/Wrong.html He posits that the notation was created for different *kinds* of things, not different *types* of things. For example, a pixel offset could be window-relative or layout-relative, and you'd use a different prefix on the variable name to keep yourself (or others reading your code) from mixing them up. The use of redundant prefixes evolved out of a misunderstanding of what the original proponent meant by type. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: What does the prefix 'm' stand for ?
prefixes are from another time.. now there are good IDEs. More to write, More to explain and NO benefit. Please use your favorite IDE, that is enough. NM On Mon, Feb 22, 2010 at 4:00 PM, fadden fad...@android.com wrote: On Feb 22, 12:39 am, Bob Kerns r...@acm.org wrote: The point of style conventions is to make things easier, not provoke arguments. It succeeds at both. There is, however, NEGATIVE benefit -- actual harm, from the Hungarian Notation you find in Microsoft's code, which redundantly encodes the PHYSICAL datatype in every usage, impeding maintenance, and often leading to variables declared one way but named a different way. This article is interesting (skip down to I'm Hungary): http://www.joelonsoftware.com/articles/Wrong.html He posits that the notation was created for different *kinds* of things, not different *types* of things. For example, a pixel offset could be window-relative or layout-relative, and you'd use a different prefix on the variable name to keep yourself (or others reading your code) from mixing them up. The use of redundant prefixes evolved out of a misunderstanding of what the original proponent meant by type. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: What does the prefix 'm' stand for ?
I love these threads where people throw in their opinions as if they're fact. THIS IS A COMPLETELY SUBJECTIVE MATTER. If you like the prefixes, use them. If you don't, don't. It's that simple. There's really nothing to argue about here. There's is no good, bad, right, or wrong way about this. Do what works for you and be consistent. Moving on... - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: What does the prefix 'm' stand for ?
TreKing wrote: I love these threads where people throw in their opinions as if they're fact. THIS IS A COMPLETELY SUBJECTIVE MATTER. But wait! Isn't that an opinion? :: ducks the rotten tomatoes tossed my way :: :-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Beginning Android_ from Apress Now Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: What does the prefix 'm' stand for ?
with all due respect, it's not quite just a subjective matter :-) i *really* like visual clues to denote the scope of variables etc, so i used to use the m prefix. however, i stopped, and now i use an explicit this to denote a reference to a data member. why? well, if you use a prefix, then bean-centric code can't derive the conventional names for getters and setters from your members. private int mWidth - getMWidth () and setMWidth(), yuck private int width - getWidth () and setWidth (), better I love these threads where people throw in their opinions as if they're fact. THIS IS A COMPLETELY SUBJECTIVE MATTER. If you like the prefixes, use them. If you don't, don't. It's that simple. There's really nothing to argue about here. There's is no good, bad, right, or wrong way about this. Do what works for you and be consistent. Moving on... -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: What does the prefix 'm' stand for ?
On Mon, Feb 22, 2010 at 4:45 PM, TreKing treking...@gmail.com wrote: THIS IS A COMPLETELY SUBJECTIVE MATTER. Computer science teaches us to 'always do the simplest thing that will work'. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: What does the prefix 'm' stand for ?
On Mon, Feb 22, 2010 at 4:50 PM, Mark Murphy mmur...@commonsware.comwrote: But wait! Isn't that an opinion? Nope, that's fact =P On Mon, Feb 22, 2010 at 4:56 PM, Jason Proctor jason.android.li...@gmail.com wrote: why? well, if you use a prefix, then bean-centric code can't derive the conventional names for getters and setters from your members. OK, so the style you chose was subject to the tool you were using. Doesn't mean it's better or worse. All I'm saying is these discussions on style, format, and convention are usually pointless ... especially when the OP asked a simple question what was answered immediately. To each his own. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: What does the prefix 'm' stand for ?
The Android Code Style Guide explains the conventions used for field names: http://source.android.com/submit-patches/code-style-guide#field_names. Sam Dutton On Feb 22, 5:52 am, Christ wutie...@gmail.com wrote: Hi guys, I saw many sample codes that each variable contains the 'm' prefix. I don't know what this m means. I have two-year experience in MFC. Each variable has 'm' prefix to tell you that I'm the one variable of MFC component. (m stands for MFC). So...can anybody answer me this question? Regards, Christ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en