It has been a while since it was last discussed online, but it has this nasty habbit of returning over and over again: Hungarian Notation.
And I'll admit, my presentation on NavTechDays contains a slide about the subject too.
There are as many opinions as there are developers.
So what is it about, this "Hungarian Notation". Basicaly it's about variable naming. There is even a page on MSDN about the name.
It's called Hungarian Notation because its inventer was a eastern (or central) european guy so his collegues started to call it Hungarian Notation. There, you know it.
The principle is about the value of adding type identifyers to your variables. Something that has been discussed at any Nav Partner probably over and over again.
Problem is, in order for this to work, there has to be a standard that everyone in an ecosystem uses.
Whether you like Hungarian Notation or you don't, fact is that Microsoft Dynamics NAV does not have that, so every attempt to introduce it will undoubtly fail, unless you rewrite the base application and never interact with other NAV applications in the ecosystem.
Other problem is, many partners and/or developers do use it, but all with their own way, so the problem gets even worse since code get's moved around and people switch jobs or partenrs swicht systems. AARGL.
Microsoft has stopped promoting this methodology years ago and Navision has never used it.
Variables used in Dynamics NAV have a tendancy to be self explaining, like Amount, which is most likely to be a decimal right? And CustLedEnt must be a variable of the record Customer Ledger Entry.
When I started programming the company I used to work for used a Data Dictionary which only allowed you to use variable and field names that where in this Dictonary. When you wanted to use something else you needed to request this name at with the DBA guys. Needles to say this was a COBOL system even though I'm only 34 years old. . Not everything in Cobol was bad you know, except waiting 15 minutes to compile if you're lucky. BTW: This company did not use Hungarian Notation either.
Only exception IMHO are extra explaining identifiers that cannot be derived from the self explainingness of the variable, such as Temp or Buffer for a temporary record variable or p for a pointer in a function.
Anyway, I'll pobably cause some reactions since this is, like I said, somthing that has many, many opinions.
So what are my reasons not to believe in Hungarian Notation
This is published in the contents of my presentation at NavTechDays and with regards to the Partner Ready Software project.
I agree the following statements:
- our code should be readable and self explaining
- readable means: you get the meaning and the scope
We get the type in the status bar but not the scope.
I would like to discard all variable names ending just with a number like Customer1, Customer2, etc. Even it might be the common metholology I prefer to add a litte suffix to explain the usage. For example if one record is for loop through a set of rows in a table and another record is for treating (like MODIFY) I would name the variables as Customer and CustomerWrite or CustomerLoop and Customer.
But at the end it is not that important. I'd like more programmers follwing programming methodology like they are mentioned in Robert C. Martin's "Clean Code".