Tips For Writing Software

Write Pseudo-code

Write a solution in pseudo-code before coding.  This will help you understand the problem and understand how to solve it.  There is no sense in coding if you don’t understand what the problem is or know how to solve it.

Compile Often

Your code should compile at all times. This doesn’t mean it will run correctly.  But if you can’t compile your code, you surely won’t be able to run it.  Compile your program after each complete statement is typed. Make a habit of this!  Open up two terminal windows so you don’t have to repeatedly open and close your editor.  Use one to compile and use the other to edit.

Test Often

When adding code that sets or changes the value of a variable, test the computation with print statements before and after the value has been assigned to the variable.

Test Strategically

Test your code with the simplest input possible.  If your program appears to work correctly on the simple input, test your code with different values.  If it appears that your program is correct, try to think of corner cases and test with those values.

© 2017, Eric. All rights reserved.