Software Professionals- Do you have a naming convention for your code at work?

Zombie

Platinum Member
Dec 8, 1999
2,359
1
71
We don't a naming convention(yet) and absolutely hate people trying to shove a naming convention down my throat. I am all for comments and self-explanatory variable names and function names but stuff like inserting _m for member variables sounds stupid to me.

What do you think?
 

PlatinumGold

Lifer
Aug 11, 2000
23,168
0
71
Originally posted by: Zombie
We don't a naming convention(yet) and absolutely hate people trying to shove a naming convention down my throat. I am all for comments and self-explanatory variable names and function names but stuff like inserting _m for member variables sounds stupid to me.

What do you think?

why not?

sometimes i think programmers don't want to follow convention in order to protect their code. i work at it from the support aspect so my outlook is obviously different from that of coders.
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Yes... it's not required, but I usually indicate the data type in the variable name. I also use camel notation.
 

DannyLove

Lifer
Oct 17, 2000
12,876
4
76
My naming convension is like this:

Class OrderDetails.

Dim aLocalPara As String.

I use the uppercase lowercase method. Looks cleaner + I hate using underscore in code. I only like it in file names :)

dany~!
 

Zombie

Platinum Member
Dec 8, 1999
2,359
1
71
As long as variable name represents something meaningful why do you need stupid stuff like _m, or _datatype tagged onto it? Try typing that crap in 100 or so different lines it gets annoying fast. If i wanted to protect my code and wanted to screw with you I could do something like this

String m_Float_DataMember_ptr; :)

So there I followed convention and still managed to protect my code.
 

Jumpem

Lifer
Sep 21, 2000
10,757
3
81
Yes. Our software design documents and coding standards have hundreds of guidelines.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Originally posted by: Zombie
We don't a naming convention(yet) and absolutely hate people trying to shove a naming convention down my throat. I am all for comments and self-explanatory variable names and function names but stuff like inserting _m for member variables sounds stupid to me.

What do you think?

How big is your company? How many programmers work on your team? One of the benefits of naming conventions is that it makes your code more readable to other programmers, regardless of whether you have comments or not.

Coding conventions also helps make your code look more consistent from module to module. If multiple people are coding with different naming schemes, it can make your code difficult to follow.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
It's absolutely required. When you work on the code of others you should generally try to assimilate their conventions, provided of course that they have conventions at all.

Many frameworks also publish convention guidelines. .NET, Java, C, Perl, and countless others all have published guidelines.
 

Garet Jax

Diamond Member
Feb 21, 2000
6,369
0
71
Originally posted by: Zombie
We don't a naming convention(yet) and absolutely hate people trying to shove a naming convention down my throat. I am all for comments and self-explanatory variable names and function names but stuff like inserting _m for member variables sounds stupid to me.

What do you think?

I think 10 years ago _ may have made sense in names, but with today's IDEs and class segmentation paradigms, it is very easy to tell where a variable is declared/instantiated.

I find _ make the code much more difficult to read.

My opinion.

PS - I have been on assignments where the technical lead(s) insist on _. I don't argue. When I am the technical lead, I insist on no _. :)
 

Garet Jax

Diamond Member
Feb 21, 2000
6,369
0
71
Originally posted by: Garet Jax
Originally posted by: Zombie
We don't a naming convention(yet) and absolutely hate people trying to shove a naming convention down my throat. I am all for comments and self-explanatory variable names and function names but stuff like inserting _m for member variables sounds stupid to me.

What do you think?

I think 10 years ago _ may have made sense in names, but with today's IDEs and class segmentation paradigms, it is very easy to tell where a variable is declared/instantiated.

I find _ make the code much more difficult to read.

My opinion.

PS - I have been on assignments where the technical lead(s) insist on _. I don't argue. When I am the technical lead, I insist on no _. :)

I misunderstood the question. Sorry. :eek:

Conventions are absolutely essential. You may not agree with some of the convention's standards. As I alluded to above, that really doesn't matter. It is one of your responsibilities to follow it.

Having said that, if something makes no sense, you need to convince the technical lead to abolish it project wide. If they are not willing to do so, then you should follow it.
 

Digobick

Platinum Member
Oct 9, 1999
2,467
0
76
Originally posted by: Garet Jax
Having said that, if something makes no sense, you need to convince the technical lead to abolish it project wide. If they are not willing to do so, then you should follow it.
I agree.

Personally, I once used the Hungarian notation (strValue, intIndex, etc) but I've sinced moved away from that and am now trying to convince the other developers at my company to follow suit. So far, most people agree with me that they're pointless nowadays (For example, Visual Studio .NET lets you get the variable type by simply hovering over it).

Other than that, there's not too much that is required where I work. We use txtTextBoxName for textboxes, btnButtonName for buttons, and so on for various objects.

Here is Microsoft's .NET documentation for naming guidelines if anyone is interested: Naming Conventions
 

Maverick

Diamond Member
Jun 14, 2000
5,900
0
71
I hate when people put the _ before the name of the variable. That just bothers the hell out of me.
 
Jun 18, 2000
11,198
771
126
I use underscores in my SQL code, but rarely in anything else. Not sure why. I've grown accustomed to seeing underscores in variable names, and in my opinion str_file_name_with_ext is easer to read than strFileNameWithExt.

I definitely name my variables something descriptive and I stick with Hungarian notation to a certain degree. My shorthand is a little different, but conceptually its similar.
 

Ameesh

Lifer
Apr 3, 2001
23,686
1
0
I prefer just simple CamelCase, even microsoft doesn't even use hungarian anymore... nobody should use it, its the worst thing ever conceived.
 

purbeast0

No Lifer
Sep 13, 2001
53,559
6,389
126
i hate you guys :(

i just graduated and am STILL looking to find a software developing job somewhere. heck, atleast I wanna just find an entry level programming job doing SOMETHING! just be happy you all are working because in 3 months, I haven't found anything yet :(
 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
the only convention i use is every program MUST have AT LEAST one global swear word variable :D
 

Goth

Senior member
Oct 22, 2001
356
0
0
Originally posted by: neutralizer
I just name things logically. I hate underscores in variable names btw.

Sounds like my naming convention. I detest underscores. Many around here use underscores to separate words. I just capitalize the first letter of each "word" (strEmployeeAge, for example).
 
Jun 18, 2000
11,198
771
126
Originally posted by: Ameesh
I prefer just simple CamelCase, even microsoft doesn't even use hungarian anymore... nobody should use it, its the worst thing ever conceived.
Personal preference or some technical reason I'm unaware of?
 

Jumpem

Lifer
Sep 21, 2000
10,757
3
81
Originally posted by: Maverick
I hate when people put the _ before the name of the variable. That just bothers the hell out of me.

That's one of the things we do.
 

puffff

Platinum Member
Jun 25, 2004
2,374
0
0
Originally posted by: Ameesh
I prefer just simple CamelCase, even microsoft doesn't even use hungarian anymore... nobody should use it, its the worst thing ever conceived.

i liked it, when i joined a large project it helped make the code a little easier to understand. after i became more familiar with the source i didnt need it as much, but i still continued the convention, its not like it's an inconvenience to me to use it, and maybe a future employee might find it useful