Hungarian notation is a legacy tool that was used back in the days of simple text editors and block declaration languages. Back then if you saw an identifier such as m_iHeight
you could tell it was a field of a class and an integral. It was a productivity tool. However we have long since moved to smart editors where you can generally hover over the identifier and see the same information. This makes Hungarian notation mostly useless.
It was never pretty before and in cases where compiler memory space was small this really hurt naming conventions (hence the x
identifiers). Again, not an issue these days so use solid noun-based identifier names without any notation, with a couple of exceptions.
- In pretty much every language that supports interfaces it is common to precede the interface with "I". So
IEnumerable
orIDisposable
are interfaces. - Most people prefix
_
on field names. This is just to avoid name collisions for common field names that might overlap parameter names so we can reduce the need for usingthis
on names. private int height; //Not preferred
private int _height; //Preferredvoid Foo ( int height ) { this.height = height; // This required so compiler knows we are using field _height = height; // Cleaner }
Ultimately I'm not aware of any modern language that has any naming rules for identifiers in terms of notation. So you should follow whatever style is already in use for the code you're maintaining. If this is new code then skip the Hungarian notation in general.