|
hmm.. you got point.
I thought local was meant to be method-body-local....
But how about assembly local and program local then... is a class local to it's assembly?
(just a joke...)
/cadi
24 hours is not enough
|
|
|
|
|
cadi wrote: But how about assembly local and program local then... is a class local to it's assembly?
(just a joke...)
Actually, it's a good question, and sort of points out the arbitrary qualities of coding styles. You say toehmahtoe, I say toemaytoe.
Marc
Pensieve
Functional Entanglement vs. Code Entanglement
Static Classes Make For Rigid Architectures
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
I meant local variables, as in "local variables to a routine", not "local fields to a class".
Everytime I write one of these polls I feel I should consult counsel to ensure I've covered everything. When polls start with "WHEREAS..." you know I've finally cracked.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
"Method variables" would have worked for me. I have to admint I misunderstood the poll as asking about "Class variables" (well actually, "fields" in C#).
Now that I know what the poll is asking, I have to say I'd fire anyone that didn't respond with camelCasing
|
|
|
|
|
Hmm. I still use the m_ prefix for dialog box DDX variables, as sort of a 'mini-convention' within a dialog class. It makes it easier to differentiate the variables that are used for 'dialog data exchange' from others.
Software Zen: delete this;
|
|
|
|
|
For locals? Or did you mean member vars? (I do that).
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I have been using Hungarian notation since I started programming for Windows 15 years ago. However, I sometimes experiment with different styles for code that no-one else needs to maintain. For example, I always use member Get/Set functions to access class variables, which are nearly always private, so, IMHO, as long as the member variable has a sensible name, there is a good argument for dispensing with Hungarian notation altogether. In some of my classes I have even switched from prefixing all my member variables with m_ to instead using a _ suffix, e.g.:
From:
std::wstring m_strName;
To:
std::wstring name_;
If someone else is going to use the class, ALL access to name_ is via methods. However, if someone else were to come along and maintain my code, then they might not like this naming convention. We have no rules for this here - it is up to the individual - and as many of the guys here are Unix programmers, where Hungarian notation is virtually unknown - forcing them to use it would be counter-productive.
Interestingly, I am doing a Java course at the moment, which tells you to use camel notation, but shys away from any Hungarian-style notation - again, it says you should just use a sensible name for the variable.
|
|
|
|
|
for simple loops i tend to use "int i", after all, it is traditional
i like hungarian when it helps
but when i reach fun things like:
std::list< std::pair< std::string, CLongClassName > >
or worse, i give up, and call it something sensible like: m_listDrugMapping
i hate having to move the mouse over a variable and waiting for the IDE to tell me what it is, and this does not work when editing the same code in a different editor on a different OS, so i do what ever helps, so long as it is not to much trouble.
zen is the art of being at one with the two'ness
|
|
|
|
|
feline_dracoform wrote: std::list< std::pair< std::string, CLongClassName > >
Personally, I wouldn't include the fact it is a "list" in the variable name - I sometimes change the container type (i.e. you might decide a vector is better at some point down the line), so I would tend to use cnt to indicate it is a STL container - then the implementation can be changed later without messing up the variable names.
|
|
|
|
|
interesting point. to be fair the code snippet is fake, since i use Qt 3. due to a massive lack of STL classes on our UNIX box i have to stick to the collection classes included with Qt 3. realistically i cannot change the collection type later on, since they tend not have compatible interfaces
zen is the art of being at one with the two'ness
|
|
|
|
|
feline_dracoform wrote: due to a massive lack of STL classes on our UNIX box
Why is this? I thought Unix environments were supposed to be up-to-date?
Kevin
|
|
|
|
|
*cough* typedef *cough*
Ryan
"Michael Moore and Mel Gibson are the same person, except for a few sit-ups. Moore thought his cheesy political blooper reel was going to tell people how to vote. Mel thought that his little gay SM movie about his imaginary friend was going to help him get to heaven."
- Penn Jillette
|
|
|
|
|
*shudder* personally i diskile typedef for things like this, because then i do not know what it is. does this type have an iterator? which iterator types, if any? is it a list or a map? maps have a different interface (at least in Qt, which is what we use) to lists, so knowing the difference is very important.
it is a personal preference, but i hate having to go hunting through files to find out what i am manipulating.
zen is the art of being at one with the two'ness
|
|
|
|
|
I use camelCasing and someitmes Hungarian too
Which one would be standrard one?
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
Whatever I feel like.
I will mostly use obscure variables and names, which does make it hard for the next guy, but it does secure the job for me
|
|
|
|
|
|
Yes it is. Hence the " "
|
|
|
|
|
WayneMJ wrote: it does secure the job for me
It does secure that you'll spent your life maintaining legacy code, because you won't get any new projects and nobody can read the old ones.
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Hi, what does 'camel cased' stands for? What about 'pascal cased'?
Can you give me some examples? Thanks in advance for your answer.
|
|
|
|
|
camelCasedIsWhereTheFirstLetterOfTheFirstWordIsLowerCaseWhileTheRestAreUpperCase
PascalCasedIsWhereTheFirstLetterOfTheEachWordIsUpperCase
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
-- modified at 2:54 Monday 3rd April, 2006
|
|
|
|
|
I use camelCase for local variables and HungarianNotation for GUI constrol, such as txtUsername.
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
Dario Solera wrote: HungarianNotation for GUI constrol, such as txtUsername
That's my one concession to Hungarian these days. Though strictly speaking, in .NET say, we should write "usernameTextBox."
Kevin
|
|
|
|
|
Not according to the designer created names we see in VS.. e.g. textBox1, textBox2 etc - for me this indicates that we should probably be naming like so: textBoxUserName, textBoxPassword etc. Which fits nicely with the C# design guidelines.
|
|
|
|
|
|
Exactly.
I used to use hungarian when I was using c++, because that was what everyone in the company was using. Now I switched to Java, so I use camel which is the standard.
Going against the standard is a bad idea, you would just be making extra work for yourself for no reason
|
|
|
|