Learning Objectives
Developing code: error messages, debugging, comment statements, writing, saving and retrieving program files
Lesson readings,Website links:
Sample code link:
Error Messages and Debugging software
As you have already discovered, BlueJ provides some very detailed information in its error messages when you compile. Sometimes that detail is a little overwhelming as you just start programming; however, the information provided allows you to rapidly find the error (be they syntax or programming itself) in your programs.
This error message tells you that the line with the red block to the left has an error. The squiggly line points out the error (well, not quite). Looking closely, you will see what is one of the most common Java coding errors: forgetting that the System object starts with a capital (upper case) "S". Correct that typo, the red block goes away, the "Error(s) found in class" message is removed, and when compiling, you should see the "Class compiled -- no syntax errors" will display.
When you write code, you should be documenting the code as you go, using one of the two comment delineators: either // for a single line comment or /* comment */ for multiple line comments. As a bare minimum, you should identify in a comment EVERY variable, constant, and literal in the code; Identify by type, purpose, arguments, return type and purpose all classes and methods; comments in the header and read-me file when you make changes for different versions to either add functionality or document troubleshooting; and any other comments you find you will need as you code. I will frequently build skeleton classes and methods, and then put comments within the structure to help me remember what I intended to accomplish with a snippet of code.
Debugging depends on your being able to 1) read the error message, 2) properly comment and document, 3) think logically as you continue.
Writing, Saving, and Retrieving code
Here are a few standards you need to remember when you write your programs for class.
170509_walrath_U01L05_Program01
where the date is 17 (2017) 05 (May) 09 (9th of May 2017), my name, Unit 01 Lesson 05 Program 01.