Incremental Java
Summary

Recap

What does it take to write a program? First, you should design the program. Of course, since you know very little about programming, you can't do too much design.

Next, you write down the program in Java, either on paper, or in a text editor (possibly in an IDE).

Then, you compile. If the compile fails, you must correct the syntax errors in your program.

Once the errors are corrected, you run the program to see if the program is doing what you expect. You test the program thoroughly by trying it out on many different inputs, and inspecting the outputs to see if it's correct. It's possible to have the program partly test itself, too.

If there are errors, you must locate the error, then determine why the error occurred, then attempt to fix the error. This is called debugging. A debugger can help you understand what your program is doing. It helps you trace the flow of your program, seeing which statements are run, and what values various variables have.

Sometimes, once a program works, you go back and restructure your program so it is nicer. Right now, you don't know what nicer means. There are many ways to write a program, but some ways are nicer than others. They make it easier to read, easier to debug, easier to make changes with the confidence that the changes will work.

Summary

Here are the steps of developing code.
  1. Design the code
  2. Write/edit the code
  3. Compile the code. Fix syntax errors.
  4. Run the program.
  5. Test and debug the code.
  6. Re-edit the code, and recompile
It's important to remember that when you make changes to a file, you need to recompile the program. This doesn't happen automatically (although some IDEs will recompile when you attempt to run, if you haven't done so).

Some suggest that you should write testing code early on. We'll talk about that in a future lesson.