Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>Debunking the benefits of Hungarian Notation</h2> <ul> <li><strong>It provides a way of distinguishing variables.</strong></li> </ul> <p>If the type is all that distinguishes the one value from another, then it can only be for the conversion of one type to another. If you have the same value that is being converted between types, chances are you should be doing this in a function dedicated to conversion. <em>(I have seen hungarianed VB6 leftovers use strings on all of their method parameters simply because they could not figure out how to deserialize a JSON object, or properly comprehend how to declare or use nullable types.</em>) If you have two variables distinguished only by the Hungarian prefix, and they are not a conversion from one to the other, then you need to elaborate on your intention with them.</p> <ul> <li><strong>It makes the code more readable.</strong></li> </ul> <p>I have found that Hungarian notation makes people lazy with their variable names. They have something to distinguish it by, and they feel no need to elaborate to its purpose. This is what you will typically find in Hungarian notated code vs. modern: sSQL vs. groupSelectSql (<em>or usually no sSQL at all because they are supposed to be using the ORM that was put in by earlier developers.</em>), sValue vs. formCollectionValue (<em>or usually no sValue either, because they happen to be in MVC and should be using its model binding features</em>), sType vs. publishSource, etc.</p> <p>It can't be readability. I see more sTemp1, sTemp2... sTempN from any given hungarianed VB6 leftover than everybody else combined.</p> <ul> <li><strong>It prevents errors.</strong></li> </ul> <p>This would be by virtue of number 2, which is false.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload