in Search

Hungarian Notation

Last post 07-04-2009, 23:10 by DanielV. 2 replies.
Sort Posts: Previous Next
  •  07-04-2009, 20:57 30046

    Hungarian Notation

    Is it possible to remove it?
    I find it very distracting specially for a newcomer.

    Thanks in advance,

    Daniel
  •  07-04-2009, 21:21 30048 in reply to 30046

    Re: Hungarian Notation

    Hi Daniel,

    Welcome to the forum.

    Once you have the MDK you can do almost anything!  If you want to wade through the headers etc and change each instance to a non-Hungarian notation format then you can.  Personally, I wouldn't and I would strongly recommend that you get used to the concept, practice it and use it in all of your coding.

    The beauty of this style of naming convention is that "everyone" uses it, and, it will help you identify each data-type just from the variable name

    e.g. a_fData
    a_: an argument passed into the function as opposed to l_ which is the locally declared variable
    f: of a float data type

    e.g l_iMaxRecords
    l_: a locally declared variable
    i: of the integer data type

    So why is this important?  What happens when you multiply a float by an integer?  Using Hungarian notation reminds the programmer of each data type as they write the code, so when they write something like:

    X * Y

    could get unreliable results if they are different datatypes, whereas:

    l_iX * a_lfY

    should spark some immediate attention to the fact X and Y aren't the same data types.

    Using l_ and a_ also allow the programmer to use the same variable descriptor for,  say, Profit where l_lfProfit is the profit target for this trade and a_lfProfit is the static variable for all trades e.g. if(l_fProfit >= a_lfProfit) {//whatever}


    Just like when learning any other language, proficiency and fluency takes time and a little practice.


    Hope this helps.

    wabbit Big Smile [:D]


    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
    Edsgar W. Dijkstra

     

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status :
    My SkyPE account : wabbit.com.au

  •  07-04-2009, 23:10 30050 in reply to 30048

    Re: Hungarian Notation

    Helps and a lot! Thanks for the explanation and the tip! Daniel
View as RSS news feed in XML