The next fundamental programming tip I can offer you is naming your variables appropriately. I find that a majority of logic or compile errors are caused by a misuse of variable names.
Here are some examples of bad naming conventions:
1. dim newvalue as Integer
2. int x = 0;
3. JLabel label1 = new JLabel();
Laid out here, it is pretty easy to recognize what each variable does, but in a simple program of at least 500 code lines it can prove rather difficult to track these variables.
Here are some suggestions.
In the first case, think about what "newvalue" represents. We know it is an integer but what is it used for? If it is a counter for a while loop, then how about doing this instead,
dim iCount as Integer
It is quite clear that this variable is of type interger and will be used as a counter.
The second example is sort of the same situation. A lot of the times one letter variables are declared in C++ and Java, for mathmatical algorithm or for loop statements. In those cases I feel it is perfectly good coding structure to use these variables as is. If this variable was to refer to a randomly produced interger used in a lottery machine, then the use of x as that variable name proves quite ambiguous.
In the third case JLabel label1 = new JLabel(); in this case, you should be more descriptive as to what label1 points to, either what sort of information is produced from this label, or where it is located.
If this label was created as the title of a progr
Graham McCarthy, has 6 years experiance developing software for both educational and business oriented purposes.
Website: http://concisecoding.blogspot.com/
Certification:
- A College Diploma in Computer Programming Analysis from Fanshawe College in London, Ontario Canada.
- A University Degree in Information Technology /w Honours from York University in Toronto, Ontario Canada.