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.

1
  • 7
    "Is there a name for this": a polite name, you mean? :-)
    – Raedwald
    Sep 30, 2011 at 12:21

2 Answers 2

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

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.
    – A.R.
    Sep 30, 2011 at 12:25
  • 1
    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.
    – Fred Foo
    Sep 30, 2011 at 12:27
  • blah blah blah, If you think the title of the question is wrong then change it to something more suitable.
    – A.R.
    Sep 30, 2011 at 12:36
  • My point is that this is Hungarian notation and there's no reason to call it anything else.
    – Fred Foo
    Sep 30, 2011 at 12:41
  • 1
    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?
    – A.R.
    Sep 30, 2011 at 13:22
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?

3
  • hmm.. I was hoping for something a bit more compact, like "Greek Notation" or whatever.
    – A.R.
    Sep 30, 2011 at 12:35
  • 14
    How about "notation Hungarian" :-) Sep 30, 2011 at 12:48
  • 5
    +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. Sep 30, 2011 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.