@jcaser1948
Lots of things can be done to improve the code. Here are some general advices:
- Bad input equals bad output (aka garbage in, garbage out)Don't trust any data you received. Write some codes to check any input before you use it, save it or continue to the next process. Always check if it is empty or not, and it is in the acceptable range. If it is not valid, show a message to the user and abort the following process, you can use
Exit command for this.
- Write the code neatlyFormat the code to make it readable by using proper blank lines, spaces, indentations. Give proper names for variables, constants, etc. Provide some comments when needed. You can find and fix bugs much easier if the code is nicely written.
- Use Divide and Conquer strategyWhen you find hard to solve problem in programming, try to divide it into several sub processes. Start new project for each of the sub process for testing. Only you're sure they works correctly, then merge it back to the main project. Don't do testings on the 'real' project, it can introduce many new bugs.
- Have enough sleepConcentration is very important for a programmer. I write buggy codes when I am sleepy.