Specification 1.0 for Java. Last updated 2017-03-20 17:14
Specification under revision. Provisional.
MT Notation is very different from Java and PHP. However they keep the same logic.
It is based on old Hungarian notation and before judging it think that some of the best Engineers I know use it. Some in Facebook. Specially for C, C++ and Python.
In loving memory of Emilio. A very nice guy and a really clever C++ developer. Much clever than me.
The idea behind the MT Notation is to help solve bugs quickly. Many would think that the notation is not necessary cause modern IDEs have error syntax, and Java have strong typing.
That’s the theory. Now look at a real case. Imagine that you’re working with currencies and somewhere you loss the floating precision.
You can waste hours debugging, sometimes that’s not easy, specially on web.
Now imagine that your variable looks like:
With a single eye-sight you would catch where the problem is.
Or imagine that you variables like:
That would greatly help identifying each type when debugging.
Well, the MT Notation helps with that, in a much more discrete way. :)
General Optional Prefixes
Optionally you can use the prefix p for class properties, so widely visible across the class.
You can use l for local variables, v for variables passed via value. Objects that are referenced (even if Java passes the reference via value) do not have the v prefix, to differentiate from those that can locally safely overwritten.
Variable Type Prefixes
|b||Boolean||For the Boolean type. bSuccess|
|c||Char||For the Char type. cLetter|
|d||Double||For the Double type. dAmount|
|f||Float||For the Float type. fValue|
|i||Integer||For the Integer type. iAmount|
|o||Object||For the any Object. oCar|
|r||Short||For the Short type. rAmount|
|s||String||For the String type. sName|
|y||Byte||For the Byte type. yValue|
Structures Type Prefixes
It goes in front of the variable type.
So, for instances aiAmount is an Array of Integers.
|a||Array||For the Array. Array of Integers. aiAmounts|
|h||HashMap||For the HashMap. hsKeys|
|l||ArrayList||For the ArrayList. asNames|
Again, if you expect to have an Array, and you have an ArrayList, you will quickly identify the problem in your code. Also you will know which data structures are behind the code so is easy to improve the code or reduce the memory use.