{"id":350,"date":"2008-06-14T04:00:29","date_gmt":"2008-06-14T08:00:29","guid":{"rendered":"http:\/\/www.rakkar.org\/blog\/?p=350"},"modified":"2008-06-14T04:00:29","modified_gmt":"2008-06-14T08:00:29","slug":"the-proper-use-of-hungarian-notation","status":"publish","type":"post","link":"https:\/\/rakkar.org\/blog\/index.php\/2008\/06\/14\/the-proper-use-of-hungarian-notation\/","title":{"rendered":"The proper use of Hungarian notation"},"content":{"rendered":"<p>\t\t\t\tJoel on Software has a great <a HREF=\"http:\/\/www.joelonsoftware.com\/articles\/Wrong.html\">article<\/a> about the proper use of Hungarian notation. Basically, most people these days that use Hungarian notation use it to indicate fundamental type to some degree &#8211; i for integer, str for string, p for pointer. Usually these types reflect the machine, such as indicating if a variable is a pointer.<\/p>\n<p>However, the original design had Hungarian notation indicate intent, not type. For example, if you had a calendar display with a month, date, and year, you would have 3 integers prefixed with an m for month, d for date, and y for year. Not i, even though they are all integers.<\/p>\n<p>Joel says it better than I can, but to put it succinctly the first is a waste of time, because you are repeating what the computer already tells you and then having to maintain it as well. The second is quite useful &#8211; just as all comments should indicate intent, so should Hungarian notation which is just an abbreviated comment.<\/p>\n<p>In <a HREF=\"http:\/\/www.jenkinssoftware.com\">RakNet<\/a> I will use numBits vs. numBytes. An even better approach is to comment the purpose and scope of variables where declared.<\/p>\n<p>Every game company I&#8217;ve worked at except <a HREF=\"http:\/\/www.n-fusion.com\/\">nFusion<\/a> has used Hungarian notation. Most of the middleware libraries do as well. A notable exception is <a HREF=\"http:\/\/irrlicht.sourceforge.net\/\">Irrlicht<\/a>, which also happens to be one of the friendliest and best designed, though not the most feature-rich.<\/p>\n<p>I&#8217;m curious what other game companies and libraries do not use Hungarian notation, vs. those that do.\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Joel on Software has a great article about the proper use of Hungarian notation. Basically, most people these days that use Hungarian notation use it to indicate fundamental type to some degree &#8211; i for integer, str for string, p for pointer. Usually these types reflect the machine, such as indicating if a variable is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/posts\/350"}],"collection":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":0,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"wp:attachment":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}