Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Hungarian notation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Advantages== (Some of these apply to Systems Hungarian only.) Supporters argue that the benefits of Hungarian Notation include:<ref name="simonyi" /> * The symbol type can be seen from its name. This is useful when looking at the code outside an integrated development environment — like on a code review or printout — or when the symbol declaration is in another file from the point of use, such as a function. * In a language that uses [[dynamic typing]] or that is untyped, the decorations that refer to types cease to be redundant. In such languages variables are typically not declared as holding a particular type of data, so the only clue as to what operations can be done on it are hints given by the programmer, such as a variable naming scheme, documentation and comments. As mentioned above, Hungarian Notation expanded in such a language ([[BCPL]]). * The formatting of variable names may simplify some aspects of [[code refactoring]] (while making other aspects more error-prone). * Multiple variables with similar semantics can be used in a block of code: dwWidth, iWidth, fWidth, dWidth. * Variable names can be easy to remember from knowing just their types. * It leads to more consistent variable names. * Inappropriate type casting and operations using incompatible types can be detected easily while reading code. * In complex programs with many global objects (VB/Delphi Forms), having a basic prefix notation can ease the work of finding the component inside of the editor. For example, searching for the string <code>btn</code> might find all the Button objects. * Applying Hungarian notation in a narrower way, such as applying only for [[Member variable|member variables]], helps avoid [[naming collision]]. * Printed code is more clear to the reader in case of datatypes, type conversions, assignments, truncations, etc.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)