Home » U++ Library support » U++ Library : Other (not classified elsewhere) » User lists of "bad" naming of classes, functions etc in U++...
Re: User lists of "bad" naming of classes, functions etc in U++... [message #7477 is a reply to message #1574] |
Sun, 31 December 2006 04:20 |
Coder
Messages: 3 Registered: December 2006
|
Junior Member |
|
|
From my experience working on large programming teams, having the variable scope prefixed to variables name helps make code a lot easier to read, and allows for different scopes to use the same name variable (less variable name conflicts). It helps in readability in that in looking at a piece of code, you don't have to search for the declaration of a variable in order to determine if it is a local, member, inherited member, static or global variable, and also in trying to understand how a member is used and doing a search you don't accidentally come across a local variable named the same as a member. The ones used in Hungarian Notation are s_* (s_Var) for static variables, g_* (g_Var) for global variables, m_* (m_Var) for class/struct member variables. Since member variables are most often used, sometimes I've seen code where they don't use an underscore, m* (mVar), or they only use underscore _* (_Var). I've also seen some use a_* for arguement variables, this is also useful in reducing variable name conflicts. Also, in general classes/structs with no or few functions and mostly public data, don't have to use scope prefixes.
I think type prefixes are less important, but can reduce variable name conflicts in some cases, or (if there is no quick help) it allows others to quickly understand what a variable is with out looking up it's declaration.
--------
To Werner,
That is useful but not in a way that addresses much of the above. It still requires looking things up, and the information it returns has type and global, instance, class symbol. It doesn't appear to work for local variables. Plus it adds additional information that is kind of confusing about its locality.
There are similar things you can have in Visual Studio, one of them you hover the mouse and it tells you the type and what it is a member variable (if it is a member at all).
But really nothing beats being able to look at variables and know their scope, with out having to look it up. It may also be useful if there were some how a way to color code variables based upon their scope. But you still run into one of the other issues, the variable name conflicts.
[Updated on: Wed, 10 January 2007 20:23] Report message to a moderator
|
|
|
|
|
User lists of "bad" naming of classes, functions etc in U++...
By: fudadmin on Thu, 09 March 2006 03:50
|
|
|
Arijus' list of "renames"
By: fudadmin on Thu, 09 March 2006 03:51
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: Coder on Sun, 31 December 2006 04:20
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: Werner on Mon, 01 January 2007 18:44
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: tvanriper on Tue, 18 September 2007 02:43
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: unodgs on Tue, 18 September 2007 08:44
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: mirek on Tue, 18 September 2007 14:38
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: mr_ped on Thu, 20 September 2007 15:16
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: mirek on Fri, 21 September 2007 14:56
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: darkwyrm on Sun, 09 March 2008 14:19
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: unodgs on Sun, 09 March 2008 18:22
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: ag_newb on Tue, 17 November 2009 10:00
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: koldo on Tue, 17 November 2009 16:48
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: mirek on Wed, 18 November 2009 08:41
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: mirek on Wed, 18 November 2009 12:48
|
|
|
Re: User lists of "bad" naming of classes, functions etc in U++...
By: tojocky on Wed, 18 November 2009 13:56
|
Goto Forum:
Current Time: Sun May 12 20:03:44 CEST 2024
Total time taken to generate the page: 0.02602 seconds
|