Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Joel on Software
Message
From
17/05/2005 10:37:29
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01014573
Message ID:
01014909
Views:
33
Hi Mike,

In a perfect world we don't need it. We only need it because we developers are stupid, forget a lot of things and make mistakes all the time. IMO, it is foolish to think that the hungarian notation is going to prevent all mistakes that can be made with types. If I look at my own imperfect code, I see that from time to time a variable contains the wrong prefix (lRetVal ISO cRetVal). Stupid, but it happens.

BTW, personally I do use a single type prefix. So in your example I would name the variable cAccountNo. I personally have no use at all for the scope prefix, maybe except when the variable is public or private. Since most variables tend to be local and the l is disturbing (since it can be read as a 1 or i) I just junk that one.

The distinction between types is far more important in C/C++ since you have to make distinctions between subtypes (WORD,DWORD,LONG, UNSIGNED INT, UNSIGNED LONG, HWND, etc) while their basetype is always the same (int 4), but the compiler would object when not casting them directly. Therefor it is important to exactly know what is stored within in variable or else a mistake is very easily made. This was the inmediate problem that hungarian notation pretended to solve.

Again, we don't suffer from these particular problems because VFP (and other dynamically typed) language do the typecast automatically.


Walter,

>Let me give you an example. Don't you find lcAccountNumber and lnAccountNumber more useful names than AccountNumber? I think the disctinction is MORE important in a weakly typed language like xBASE. xBASE is downright diabolical in letting you instantiate variables willy-nilly, no type defined, even letting you change type by assigning a different constant, and then expecting certain parameter types at run time. Kaboom!
>
>Mike
>
>
>>Hungarian notation was invented for the C programming language. It has its great value in strong (strict) typed languages has you carefully have to match types. In weak (dynamic) typed languages it is less important, casting from double to int to numeric is done automatically: there is less need to be aware of the exact type. In VFP we have only: character, boolean, numeric, date, datetime and object as base types. Therefore there is less technical need to distinguis between derived types like int, float, double and memo and text.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform