The opposite of Hungarian Notation?
Asked Answered
C

2

11

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.

Carlina answered 30/9, 2011 at 12:11 Comment(1)
"Is there a name for this": a polite name, you mean? :-)Passepartout
T
11

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?

Tenebrific answered 30/9, 2011 at 12:25 Comment(3)
hmm.. I was hoping for something a bit more compact, like "Greek Notation" or whatever.Carlina
How about "notation Hungarian" :-)Roethke
+1 A google search reveals that "Reverse Hungarian Notation" is already in frequent use. It has a nice parallelism, and many geeks would understand it without further explanation.Skilled
T
15

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.)

Toby answered 30/9, 2011 at 12:20 Comment(7)
The opposite of the beginning is the end. From the same article... "In Hungarian notation, a variable name starts with a group of lower-case letters ..." --> Meanwhile, we totally agree on the uselessness of the practice.Carlina
But the opposite of putting the type in the name is not putting the type in the name, and whether it's a prefix or a suffix doesn't really matter. It's a convention that beats the purpose of type systems both static and dynamic.Toby
blah blah blah, If you think the title of the question is wrong then change it to something more suitable.Carlina
My point is that this is Hungarian notation and there's no reason to call it anything else.Toby
Yeah, IF you follow 'Stroustrup's definition' 9999 out of 10000 people will talk about the prefix if you were to ask them to define Hungarian notation, and you know it. My point is that I am looking for a term that is distinct, rather than obscure. Kind of like how a square is a rectangle, but it has its own name to identify its special properties?Carlina
By this logic BASIC requires the use of Hungarian notation... ;-)Unsophisticated
Well according to the wikipedia page you link to "In Hungarian notation, a variable name starts with a group of lower-case letters which are mnemonics for the type or purpose of that variable". Additionally I think Stroustrup doesn't talk about placement because his point would be applicable regardless of where in the name the type indication was.Tenebrific
T
11

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?

Tenebrific answered 30/9, 2011 at 12:25 Comment(3)
hmm.. I was hoping for something a bit more compact, like "Greek Notation" or whatever.Carlina
How about "notation Hungarian" :-)Roethke
+1 A google search reveals that "Reverse Hungarian Notation" is already in frequent use. It has a nice parallelism, and many geeks would understand it without further explanation.Skilled

© 2022 - 2024 — McMap. All rights reserved.