| << 4.1.3- Naming Variables | Chapter4 | 4.2.0- Declaring Variables >> |
Naming Conventions
If we have many variants in a program, we need a way to keeptrack of which variants contain which subtype. The fact that we can convertvariants from one type to another makes this 'tracking' even more important.The sensible answer is to use a good naming convention. By doing so, you cantell at a glance whether you're using an integer, a string, or date and canmanipulate it in a consistent way.
Naming conventions aren't compulsory, can't be enforced andgenerally it's up to the programmer as to which convention to apply, but themost common one, known as Hungarian notation, is to use the first three lettersof a variant's name to distinguish the sub type. The fourth letter of thevariant is then typed in upper case, to indicate that this is where the actualvariant name starts.
Here's the suggested naming convention: we'll be using it inour applications throughout the rest of the book:
| Data Type | Prefix | Example |
| Boolean | bln | blnMember |
| Byte | byt | bytByte |
| Date / Time | dat | datToday |
| Double | dbl | dblDouble |
| Error | err | errError |
| Integer | int | intSalary |
| Long | lng | lngLong |
| Object | obj | objConn |
| Single | sng | sngSingle |
| String | str | strTextBox |
| << 4.1.3- Naming Variables | Chapter4 | 4.2.0- Declaring Variables >> |

RSS

