Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 8th, 2006, 10:30 AM   #11
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by OpenLoop
I type it all to avoid the moment where I go 'What does this program do again?'
Haven't we all had that before, even with meaningful names?
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old May 8th, 2006, 11:16 AM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Off-topic: Ruben, your PM box is full. Contact me by email.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 8th, 2006, 1:40 PM   #13
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 261
Rep Power: 3 Cache is on a distinguished road
I usually start the variable names with the first letter(s) of it's type.

e.g:
char chLetter;
char szText[10];
char* pszText;
std::string strText;
int iMax;
bool bIsSomething;
... ect.
Cache is offline   Reply With Quote
Old May 8th, 2006, 1:47 PM   #14
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Quote:
Originally Posted by Cache
I usually start the variable names with the first letter(s) of it's type.

e.g:
char chLetter;
char szText[10];
char* pszText;
std::string strText;
int iMax;
bool bIsSomething;
... ect.
Yeah, that's usually the way I do it too. It's a good habit because then you know what type the var is. I think that's the way professionals do it as well don't they? Simply because it's easier to understand the code when looking at soemone elses. Sometimes, mine are all over the place
Booooze is offline   Reply With Quote
Old May 8th, 2006, 2:09 PM   #15
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Quote:
Originally Posted by Booooze
I think that's the way professionals do it as well don't they?
No, not always the case. Although, it is good practice, in my experience I have rarely come across naming conventions like those, outside of an education environment.

However, I have came across names like iv2, qrz, bobFox, fred, asdfw2etgha, a, aa, aaa, aaaa, aaaaa and so on. Obviously, these programmers didn't want anyone to maintain their code, giving them a false sense of job security (they were wrong, as the code was rewritten).

More often than not, the variables are named in such a way that you know their purpose, not necessarily their type. IE: thermalIndex, heatSignature, balance, firstName, zipCode, etc. The type would normally be derived from how the variable is utilized within its code block in relation to other lines.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old May 8th, 2006, 2:19 PM   #16
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
I remember calling my variables "John", "Thingy", "Thangy", "counter1", "counter2", "Jack", "Blah", "Blahdieblah", "Blahdieblah1", "YourMom", etcetera when I was young .

Yeah, the good old times...
Polyphemus_ is offline   Reply With Quote
Old May 8th, 2006, 2:45 PM   #17
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Listen to IR, forget Hungarian notation. countThangy is considerably more useful than intBlahBlah. By the time you stack enough of those to know that you have a long pointer to a zero-terminated string running on hemorrhoid juice, you have made me puke in my boots, fire you, and hire another. You are, of course, entitled to your own opinion. Let us hope you don't declaim it loudly while standing in the unemployment line.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 8th, 2006, 3:11 PM   #18
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
Quote:
Originally Posted by DaWei
Listen to IR, forget Hungarian notation. countThangy is considerably more useful than intBlahBlah. By the time you stack enough of those to know that you have a long pointer to a zero-terminated string running on hemorrhoid juice, you have made me puke in my boots, fire you, and hire another. You are, of course, entitled to your own opinion. Let us hope you don't declaim it loudly while standing in the unemployment line.
Nowadays I use really normal names for my variables, I was talking about the time when I was 8 / 9 years old...
Polyphemus_ is offline   Reply With Quote
Old May 8th, 2006, 3:23 PM   #19
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Wasn't directed at you, Poly, just a general observation exacerbated, no doubt, by writing Win16 code. You ever read all those types, and THEN move on to the macros?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 8th, 2006, 3:37 PM   #20
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by DaWei
Off-topic: Ruben, your PM box is full. Contact me by email.
Off-topic: I mailed you at Yahoo, need I mail the other?
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:58 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC