Alex Rivera | Logout

Good Examples of Hungarian Notation?

Asked 2008-10-14T17:37:59.267
17

This question is to seek out good examples of Hungarian Notation, so we can bring together a collection of these.

Edit: I agree that Hungarian for types isn't that necessary, I'm hoping for more specific examples where it increases readability and maintainability, like Joel gives in his article (as per my answer).

Edit
Report

2 Answers

6

Do not use language specific prefixes.

We use:

n: Number 
p: Percentage 1=100% (for interest rates etc)
c: Currency
s: String
d: date
e: enumeration
o: object (Customer oCustomer=new Customer();)
...

We use the same system for all languages:

SQL
C
C#
Javascript
VB6
VB.net
...

It is a life saver.

answered 2008-11-29T08:04:24.633
1

I only ever use p for a pointer, and that's it. And that's only if I'm in C++. In C# I don't use any hungarian notation. e.g.

MyClass myClass;
MyClass* pMyClass;

That's all :)

Edit: Oh, I just realised that's a lie. I use "m_" for member variables too. e.g.

class
{
private:
bool m_myVar;
}
answered 2008-10-14T18:01:34.803

Your Answer