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, 4:55 PM   #21
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 261
Rep Power: 4 Cache is on a distinguished road
Quote:
Originally Posted by DaWei
countThangy is considerably more useful than intBlahBlah.
Indeed. Although I would say that 'countThangy' is considerably more useful than 'intBlahBlah', with or without the 'int' prefix.

Quote:
Originally Posted by DaWei
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, ...
This made me think. I wish this would have come up sooner, I've got literary thousands of lines of code that already use hungarian notation. And the more I'm reading about the use of hungarian notation in C++ the more I'm being put off it.

*looks for a new convention*
Cache is offline   Reply With Quote
Old May 8th, 2006, 5:05 PM   #22
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I quote, from the article, How To Write Unmaintainable Code:

Quote:
Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques; use it! Due to the sheer volume of source code contaminated by this idiom nothing can kill a maintenance engineer faster than a well planned Hungarian Notation attack. The following tips will help you corrupt the original intent of Hungarian Notation:
  • Insist on using "c" for const in C++ and other languages that directly enforce the const-ness of a variable.
  • Seek out and use Hungarian warts that have meaning in languages other than your current language. For example insist on the PowerBuilder "l_" and "a_ " {local and argument} scoping prefixes and always use the VB-esque style of having a Hungarian wart for every control type when coding to C++. Try to stay ignorant of the fact that megs of plainly visible MFC source code does not use Hungarian warts for control types.
  • Always violate the Hungarian principle that the most commonly used variables should carry the least extra information around with them. Achieve this end through the techniques outlined above and by insisting that each class type have a custom wart prefix. Never allow anyone to remind you that no wart tells you that something is a class. The importance of this rule cannot be overstated if you fail to adhere to its principles the source code may become flooded with shorter variable names that have a higher vowel/consonant ratio. In the worst case scenario this can lead to a full collapse of obfuscation and the spontaneous reappearance of English Notation in code!
  • Flagrantly violate the Hungarian-esque concept that function parameters and other high visibility symbols must be given meaningful names, but that Hungarian type warts all by themselves make excellent temporary variable names.
  • Insist on carrying outright orthogonal information in your Hungarian warts. Consider this real world example "a_crszkvc30LastNameCol". It took a team of maintenance engineers nearly 3 days to figure out that this whopper variable name described a const, reference, function argument that was holding information from a database column of type Varchar[30] named "LastName" which was part of the table's primary key. When properly combined with the principle that "all variables should be public" this technique has the power to render thousands of lines of source code obsolete instantly!
  • Use to your advantage the principle that the human brain can only hold 7 pieces of information concurrently. For example code written to the above standard has the following properties:
    • a single assignment statement carries 14 pieces of type and name information.
    • a single function call that passes three parameters and assigns a result carries 29 pieces of type and name information.
    • Seek to improve this excellent, but far too concise, standard. Impress management and coworkers by recommending a 5 letter day of the week prefix to help isolate code written on 'Monam' and 'FriPM'.
    • It is easy to overwhelm the short term memory with even a moderately complex nesting structure, especially when the maintenance programmer can't see the start and end of each block on screen simultaneously.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 8th, 2006, 5:10 PM   #23
gumbyman31
Newbie
 
Join Date: May 2006
Location: Inside
Posts: 14
Rep Power: 0 gumbyman31 is on a distinguished road
Send a message via AIM to gumbyman31
Quote:
Originally Posted by nnxion
Haven't we all had that before, even with meaningful names?
Yeah, I'm still working on breaking that habit. I used all kinds of silly names when I used to program in VB. Stuff like DefenderVal, DefendVal, DefendingVals, etc. Then I realized how impossible it is to maintain. I haven't touched that code since.
__________________
Use the best: Linux for servers, Mac for graphics, Windows for Solitaire.
gumbyman31 is offline   Reply With Quote
Old May 8th, 2006, 5:25 PM   #24
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
There is nothing you can do to make your five-year old code look like it was written by other than the most stupid inhabitant of the local looney-bin. It will forever turn your stomach. Fahgeddaboudit and move on. You'll cry enough when you have to maintain it, don't shed the tears unnecessarily. Water is an important resource.
__________________
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 9th, 2006, 2:52 AM   #25
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 Cache
*looks for a new convention*
Take a look at this coding style (naming conventions). That's for C# but will be suitable for others as well.
__________________
"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 9th, 2006, 7:17 PM   #26
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 261
Rep Power: 4 Cache is on a distinguished road
Quote:
Originally Posted by nnxion
Take a look at this coding style (naming conventions). That's for C# but will be suitable for others as well.
Looks good, at a glance. Thanks.
Cache is offline   Reply With Quote
Old May 9th, 2006, 8:18 PM   #27
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
All my variable names are x, y, z, or a combination of those 3 letters. I also use at least 50 different gotos in my program.

Actually, I usually just like to give my variables meaningful names as I go. It makes it less confusing for me. I'm serious about the gotos though. I swear.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old May 9th, 2006, 8:26 PM   #28
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
Quote:
Originally Posted by Mjordan2nd
All my variable names are x, y, z, or a combination of those 3 letters. I also use at least 50 different gotos in my program.

Actually, I usually just like to give my variables meaningful names as I go. It makes it less confusing for me. I'm serious about the gotos though. I swear.
Have mercy on the guy that will maintain your code after you. What if you get hit by a car the next morning!
OpenLoop is offline   Reply With Quote
Old May 9th, 2006, 9:01 PM   #29
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 Mjordan2nd
All my variable names are x, y, z, or a combination of those 3 letters. I also use at least 50 different gotos in my program.

Actually, I usually just like to give my variables meaningful names as I go. It makes it less confusing for me. I'm serious about the gotos though. I swear.
That can't be good...lol. As for maintaining it, I don't care, long as it's not me :banana:
Booooze is offline   Reply With Quote
Old May 9th, 2006, 9:18 PM   #30
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Quote:
Originally Posted by OpenLoop
Have mercy on the guy that will maintain your code after you. What if you get hit by a car the next morning!
goto Personal_Status;






Personal_Status:
boolean employed = false;
boolean high_school = true;
int numberOfCodeMaintained = 0;
boolean dodgesCarsForBreakfast = true;
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd 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:42 AM.

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