D - naming conventions
- imr1984 (4/4) Jan 03 2004 Can someone explain to the me the rationing of the D naming convention,
- J Anderson (19/24) Jan 03 2004 Oh, no not a style war. What looks *sloppy* to one person, looks good
- Andy Friesen (8/14) Jan 03 2004 The Java convention is probably the single most widely used convention
- imr1984 (13/27) Jan 03 2004 it says on the style guide, say no to hungarian notation, well what abou...
- Andy Friesen (7/23) Jan 04 2004 I just prefix private stuff with an underscore. I believe this too is
- Mark T (5/7) Jan 04 2004 excellent comment - if it's not in the public interface then feel free t...
Can someone explain to the me the rationing of the D naming convention, where names start with a lower case and each new word has a capital, eg: int lovelyInteger; I personally think that looks sloppy.
Jan 03 2004
imr1984 wrote:Can someone explain to the me the rationing of the D naming convention, where names start with a lower case and each new word has a capital, eg: int lovelyInteger; I personally think that looks sloppy.Oh, no not a style war. What looks *sloppy* to one person, looks good to another. I think D may have been following the java style (which follows other languages in that style, no doubt). My own reasons for liking this format are: * Because shift requires more button clicks. Underscore is even worse. * To train my brain to know what comes first in D. * Most of my local variables aren't two words (and I don't capital them either). * Most variables aren't nouns (and you type more variables then anything else) * For differentiating classes/struct/union/enum from local variables, without using *ugly* hungarian notation. Personally, I also use this for differenting members (first capital) from local variables. And so on.... But there is no right way, you've just gotta pick one and stick to it. Note that classes/struct/union/enum don't start with lower case, but I guess you know that.
Jan 03 2004
imr1984 wrote:Can someone explain to the me the rationing of the D naming convention, where names start with a lower case and each new word has a capital, eg: int lovelyInteger; I personally think that looks sloppy.The Java convention is probably the single most widely used convention today. D could do worse. *cough*Hungarian*cough* Besides, you can find someone who detests any given naming convention. Stylistic decisions are like that. It could be much worse. PFNGLARRAYELEMENTARRAYEXTPROC is kind of hard to remember. (pulled from MS's OpenGL header) -- andy
Jan 03 2004
In article <bt84jh$2nfa$1 digitaldaemon.com>, Andy Friesen says...imr1984 wrote:it says on the style guide, say no to hungarian notation, well what about properties? To distuingish a property from its variable you either have to capitalise one of em, or use hungarian notation. This example is taken from the spec: struct Foo { int data() { return m_data; } // read property int data(int value) { return m_data = value; } // write property private: int m_data; } I think the style guide needs to be more clear on this.Can someone explain to the me the rationing of the D naming convention, where names start with a lower case and each new word has a capital, eg: int lovelyInteger; I personally think that looks sloppy.The Java convention is probably the single most widely used convention today. D could do worse. *cough*Hungarian*cough* Besides, you can find someone who detests any given naming convention. Stylistic decisions are like that. It could be much worse. PFNGLARRAYELEMENTARRAYEXTPROC is kind of hard to remember. (pulled from MS's OpenGL header) -- andy
Jan 03 2004
imr1984 wrote:it says on the style guide, say no to hungarian notation, well what about properties? To distuingish a property from its variable you either have to capitalise one of em, or use hungarian notation. This example is taken from the spec: struct Foo { int data() { return m_data; } // read property int data(int value) { return m_data = value; } // write property private: int m_data; } I think the style guide needs to be more clear on this.I just prefix private stuff with an underscore. I believe this too is part of the Java convention. Either way, though, it works nicely, as it is very clear, without sucking up eyespace. In the end, though, I don't suppose it matters. It has nothing to do with the public interface. -- andy
Jan 04 2004
In article <bt8j3g$bl2$1 digitaldaemon.com>, Andy Friesen says...In the end, though, I don't suppose it matters. It has nothing to do with the public interface.excellent comment - if it's not in the public interface then feel free to use whatever style you or your team wants (unless you are writing for a journal or book where unsuspecting newbies may be influenced by too much hungarian, the Cclassname thing drives me nuts)
Jan 04 2004