Click here to visit RCCIIT Students' Linux Users' Group. Click here to visit my home page at Fedora.

Search

Too early for tomorrow... our pet project

Saturday, December 5, 2009

Hungary Kya?

Finally that we seem to have settled the preliminary algorithm development part of the first stage of our final year project, our guide (Prof. Garain of ISI) gave us a few tips on the approach to coding to follow:

1) Do not write the entire program in one module. Nothing can be done with your program then. Break it up into smaller sub modules.

2) Use a standard naming conventions for your variables like the Hungarian Notation! 

What is the Hungarian Notation? Well, it is a naming convention that prefixes certain letters before the given names of variables so that there type is recognisable instantly when the variable is discovered 5 years later, in the program. This is mainly used in languages where variables do not have any types, so there purpose is not easily decipherable. But this is also extended to better constructed languages too.

"The term Hungarian notation is memorable for many people because the strings of unpronounceable consonants vaguely resemble the consonant-rich orthography of some Eastern European languages despite the fact that Hungarian is a Finno-Ugric language, and unlike Slavic languages is rather rich in vowels."

--Wikipedia

This is no doubt to prevent people like Sarbartha from using variables like

int tag1,tag2,tag3,flag1,flag2,flag3;

Such usage may cause healthy,wealthy and wise guys like me go goofy in no time.

But look at what the Hungarian notation can do to a simple piece of code:

strcpy(arrptrvertexTemp[iCntTemp]->strNNP,arrstrNoun[iIndex2][0]);

If Sarbarthian notation makes a piece of code incomprehensible, the Hungarian notation may make a code prohibitive.

1 comment:

  1. Sarbarthian notation is much better that Hungarian notation... :P

    Hungarian Notation: strcpy(arrptrvertexTemp[iCntTemp]->strNNP,arrstrNoun[iIndex2][0]);

    Sarbarthian Notation: strcpy( tmp[i]->nnp,anu[i2][0]);

    Now tell which one is better... :P ... :D

    ReplyDelete