Re: What do you prepend your class names with?
Did I ever preppended my class names with something???
Well, in fact I did preppend with "lpp" when I started with C years ago, when no namespaces were available. For normal variables or other kinds of things (enumerations, structs or whatever) I was more confortable preppending something like the enumeration name for variables of an enumerated type, for example:
Code:
enum colors {
red, blue, green;
};
enum colors colors_window, colors_door;
and so on. The same for 'non-bool-type' bools: bool_try, bool_exit, etc.
I think now with C++ as an OOL and namespaced availabe almost everywhere, preppending names with something related to tyhe type is unnecesary. I'd rather preppend something indicating the usage, ala "CarMap", for a map that maps car types to, whatever, license numbers.
Re: What do you prepend your class names with?
Just to chime back in....
I do not currently repent names with anything to indicate their type [with the exception of certain ui elements], but I do use a combination of capitalization and prefix to indicate name scope:
local variables start with lower case.
Methods [verbs], Properties[adjectives] and Classes[nouns] start with UpperCase.
member variables are prepended with an m_
global (rare) are prepended with a g_
statics (variables) are prependes with an s_
Re: What do you prepend your class names with?
I use a coding-convention somewhat similar to the one TheCPUWizard uses.
Globals get a g_
Member-variables a m_
Statics a s_
Function parameters get a p_
For class-names (and local variable-names) I follow the convention used in the standard-library; all small letters, with words separated by an underscore. Nothing prepended or prefixed or whatever the word is... The reason for adopting that style is that I do a lot of library-development, and by using a style similar to the standard-library, users tend to feel more comfortable using them. (A *nix coder being forced to use a library written using Hungarian-notation would probably feel a bit alienated!)
I have been using Hungarian notation (A long time ago), but I found it to be too much of a hassle as opposed to what I would get back (in terms of readabillity) for the effort.
Re: What do you prepend your class names with?
Well I do what ever strikes my fancy when I happen to write a piece of code.
One day I am all for hangarian and use it like crazy, heck I even sprinkle a little
hungarian on the the hungarian and toss some postfix on there for good measure.
g_d_m_Wow_l_v_
Othes days I can not stand lower case but am still in the hungarian mood
G_D_M_WOW_L_V
Some days I am feeling lazy and so don't want to type
w
Or am lazy but still cry out in agony when forced to type lower case
W
You know....
p.s. Who out there can honestly say they have actually looked at a variable
and said, "by golly I would have thought that was a string, good thing I used hungarian notation" ?
Re: What do you prepend your class names with?
Quote:
Originally Posted by souldog
p.s. Who out there can honestly say they have actually looked at a variable
and said, "by golly I would have thought that was a string, good thing I used hungarian notation" ?
Is C++ the first lanquage you have coded in?
/We didn't have those fancy IDE's you fellars have these days...it was called print it out and take it home...
Re: What do you prepend your class names with?
Yup, C++ is my first language. Sorry if I offended you, you old fogy.
I have to admit I do use the g_ on globals.
Oh by the way, of course I don't put a C in front of my class names.
Re: What do you prepend your class names with?
Quote:
Originally Posted by souldog
Yup, C++ is my first language. Sorry if I offended you, you old fogy.
I have to admit I do use the g_ on globals.
Oh by the way, of course I don't put a C in front of my class names.
no offense...but try printing out your code, putting it in a binder, and flipping the pages...and going...now what the fark was that var declared as???
As I said...hungarian had it's place...but technology caught up...
Re: What do you prepend your class names with?
So I use all upper case for class names, typedefs ... user defined types
MY_STINKING_OBJECT
So who is with me.... rah rah rah
Re: What do you prepend your class names with?
Quote:
Originally Posted by souldog
So I use all upper case for class names, typedefs ... user defined types
MY_STINKING_OBJECT
So who is with me.... rah rah rah
I've seen your class names...mr uppercase...
Re: What do you prepend your class names with?
Quote:
Originally Posted by Mick
no offense...but try printing out your code, putting it in a binder, and flipping the pages...and going...now what the fark was that var declared as???
As I said...hungarian had it's place...but technology caught up...
Well I have to admit I didn't read most of this thread, my suspicion is that most
of the MFC bound programmers (the ones who use CArray instead of vector or
complain that "you are not following the rules of MFC when you do that" etc...)
use the C and rest don't.
I can definitely see that there was a time when hungarian notation was useful,
but most likely that time has passed. Probably just something jackass
professors can grade on now.
//I know you were not offended. I just wanted to call you an old fogy.
Re: What do you prepend your class names with?
Quote:
Originally Posted by souldog
Probably just something jackass
professors can grade on now.
Same thing I said when the push to use C++ started.
Re: What do you prepend your class names with?
Quote:
Originally Posted by Mick
I've seen your class names...mr uppercase...
Yah I love those upper case user defined types... oh yah that is the way to do it.
Re: What do you prepend your class names with?
Quote:
Originally Posted by souldog
Yah I love those upper case user defined types... oh yah that is the way to do it.
Well it certainly gets your attention.
Re: What do you prepend your class names with?
It seems to me it doesn't matter what you do as long as you are consistent and use adequately descriptive names.
I would that a programmer who gets confused reading code because the naming
convention is different than their own is not worth their salt. (PERIOD on the end
in case you did not see it)
Re: What do you prepend your class names with?
Quote:
Originally Posted by Hokutata
Much Ado About Nothing
Back to work, philosophers!
:D
Yeah. From a point you are perfectly right. ;) :thumb: