Re: How to name variables in a program?



Arafangion wrote:
I came across a rumour (I _think_ I got it from www.joelonsoftware.com), but the rumour suggests that Hungarian notation originated from a missunderstanding of Apps hungarian, particularly on the word 'type'.
For instance, Apps Hungarian would never simply say iWidth, but would use something more like scrWidth, and scrHeight, with a convention that scr means "the screen", which helps you not mix it with, say, panelWidth and panelHeight.


I'm going out on a limb here, could someone confirm or deny this?

No help on the veracity of the claim, but here is the article:

http://www.joelonsoftware.com/articles/Wrong.html

It's an interesting article, OP should have a look. As you say, Joel suggests that in its original form Hungarian noted the _kind_ of variable, not the variable _type_. An example from the excel source being xl, xw and cb prefixes, all ints, but one is the coordinate relative to the layout, the next relative to the window, and the last a count of bytes. Then if you name all your functions prefixFromWhatever, it becomes clear if you've made an error, e.g.
xlThis = cbThat;
is clearly incompatible.


Rob M
.



Relevant Pages

  • Re: How to name variables in a program?
    ... but the rumour suggests that Hungarian notation originated from a missunderstanding of Apps hungarian, ... For instance, Apps Hungarian would never simply say iWidth, but would use something more like scrWidth, and scrHeight, with a convention that scr means "the screen", which helps you not mix it with, say, panelWidth and panelHeight. ...
    (comp.programming)
  • Re: How to name variables in a program?
    ... > but the rumour suggests that Hungarian notation originated from a ... > missunderstanding of Apps hungarian, ...
    (comp.programming)