Should we use the Hungarian Notation? And if yes, is there a consistent standard? RRS feed

  • Question

  • Hello, I am a VBA beginner. Time and again I read about the pro's and con's relating to the use/nonuse of the Hungarian Notation. Also, I have the impression that there is no unique, clear and consistent standard to use the Hungarian Notation. Et al I have seen the following prefixes: bool, bol, bln, bl, b for boolean, curr, cur, crn, crnc for currency, doub, dou, dbl, db for double, strg, str, st, s for string and vart, varn, var, vrn, vrt for variant. Isn't this confusing for a beginner like me? So my questions are. 1) should I use the Hungarian Notation, and if yes 2) is there a clear consistent and unique standard? and if so, 3) where can I learn about the standard? Thanks for coming back on this!

    Tuesday, February 20, 2018 10:07 AM

All replies

  • Will the programs be developed and maintained by you only? If so then do what you want, you don't have to be politically correct.

    If you are going to hire someone to develop and/or maintain the code then you can determine the standard. If you choose something that experienced programmers don't want to use then you might have difficulty getting good experienced developers.

    If this is for an employer then form a committee to make a descision. Management likes committees. 

    Sam Hobbs

    Tuesday, February 20, 2018 10:54 AM
  • Thank you Sam for your helpful comment!
    Tuesday, February 20, 2018 11:52 AM
  • Hungarian notation was popular in the late 90's/early 2000's.  It has fallen out of fashion.  No one teaches it anymore.  VB and VBA are old languages so you'll still see it used but most everyone uses camel case.  I find Hungarian notation to be burdensome.  It leads to longer variable names and for me offers no real benefit.  You'll likely program in many languages like C#, Java, Javascript ... and no one uses it in those languages.
    Tuesday, February 20, 2018 1:09 PM
  • Thank you for your comment!
    Tuesday, February 20, 2018 2:21 PM
  • For VBA, I would stick with the same conventions. Coding conventions will change from platform to platform but that doesn't mean you use the same conventions for every platform. Otherwise, you will likely confuse other people who have been using the same coding conventions for years for a given platform.

    Visual Basic Coding Conventions

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, February 21, 2018 4:16 PM