Home | Web Design | Programming | Fairlight CMI | Soap Box | Downloads | Links | Biography | About... | Site Map |
![]() |
![]() |
HUNGARIAN NOTATION |
CA-Clipper![]() |
Opportunities | Tips and Tricks | Networking | Internal Errors | Source Code | CA-VO |
![]() ![]() CA-CLIPPER PROGRAMMING |
Hungarian Notation is a naming convention that was popularized many years
ago by Charles Simonyi at Microsoft. It is used throughout the source
code of the Windows operating system. This is a coding convention that you will find quite useful, especially in CA-Clipper which is not a "strongly typed" language. I also recommend it for use in Java and JavaScript. Hungarian Notation provides some rules that make your code more understandable. It uses a combination of mixed case to describe a variable, plus a lower case character or two in front of the name to indicate its data type. For example, if there is a numeric variable for a yearly total, it would probably be called nYearTotal . Another example:
cUserName is most likely a character variable that
contains the User's name. Hungarian Notation allows you to determine
quite a bit about the variable, just from its name. Some examples of Hungarian Notation are
acMenuItems := {"Add", "Edit", "Delete"} A two dimensional array of numbers might be expressed as: aanMatrix := { {1,2,3} , {4,5,6} , {7,8,9} } An interesting option is to precede names with "p" to indicate parameters: function ShowText ( pcText, pnRow, pnCol ) Another technique precedes static variable names with "s": function CheckPassword ( pcPassword ) Static variables that are declared before the first procedure or function in a program file (.PRG) have file-wide scope and are sometimes prefixed with "g", which stands for "global". (Although the variables are not available throughout the entire program, just the one program file, the word "global" seems appropriate.) static gnPage I highly recommend Hungarian Notation. But note that it is just a convention that is generally agreed upon by programmers as the "right" way to name variables. It is not enforced by the CA-Clipper compiler -- it is just a good idea.
To see how HN can work with Java, see my article Applying Hungarian Notation to Java programs Part 1 ![]() ![]() |
Home | Web Design | Programming | Fairlight CMI | Soap Box | Downloads | Links | Biography | About... | Site Map |
![]() |
![]() |
Send comments about this site to Greg at
gregh@ghservices.com All pages copyright © 1996-1999 GH Services Created 1997/06/02 Last updated 1999/10/05 All trademarks contained herein are the property of their respective owners |