- Write out the equations to be solved, their discretized forms, and a basic outline of the code (pseudo code).
- Use comment statements – explain what the next block of lines is doing 3. Explicitly define and describe all variables.
- Use meaningful variable names. Instead of x, z, use length, width, and height. This is very helpful, both in reading (and rereading) the code, and also for searching for variables.
- If you cannot solve your problem, solve an easier problem first.

### Helps for Debugging Code

- Always output the input to verify that you have the right numbers
- Plan for errors:
- Include intermediate output (not just the final answer)
- Use simple approaches – not convoluted logic
- Check answers independently.

- “Play computer” line by line, evaluating the logic. This is easier with a debugger 4. Explain your logic to someone else (or yourself out loud).
- Be aware of roundoff errors (just use double precision)
- Check for:
- mathematical hierarchy,
- integer division,
- correct array dimensions, transferring arrays from subroutines,

These guidelines will slow you down for very simple codes, but in the long run, they will save you a lot of time and effort if you are involved in real code development.