The opposite of Hungarian Notation?

孤街浪徒 提交于 2019-12-19 06:05:06

问题


Most programmers know of a thing called 'Hungarian Notation', each variable has a nice prefix to denote its data type, i.e.

bIsExciting = false;    // Boolean
strName = "Gonzo";      // String
iNumber = 10;           // Integer

While this style of notation has fallen out of favor, I am seeing (at work, internet, etc.) a lot of data type indicators added as a 'suffix' to variable names, i.e.

NameStr = "Gonzo";        // String
NumberInt = 10;           // Integer
MyRideBike = new Bike();  // Bicycle

Is there a name for this, when the data type is suffixed to a variable name?

EDIT: To clarify..., is there a distinct name for such a thing? If not, some concise ideas on what to call it would certainly be appreciated.


回答1:


I would call this reverse hungarian notation which would be consistent with the difference between polish notation and reverse polish notation.

Additionally billmcc's post on the following link shows real life usage of the term "reverse hungarian notation" What was the strangest coding standard rule that you were forced to follow?




回答2:


This is not the opposite of Hungarian notation, this is Hungarian notation in a different guise, if we follow Stroustrup's definition of Hungarian notation as "embedding an abbreviated version of a type in a variable name". If you want to call it anything, call it suffix Hungarian. (And please tell your colleagues that it's useless in most cases.)



来源:https://stackoverflow.com/questions/7610157/the-opposite-of-hungarian-notation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!