A bit of advice for code writing

  • In the class CheckerBuggle write the header of the method that will draw the picture.
    --Think of a good name for the method.
    --Put the opening and closing braces { and } for the body of the method.
    --Do not yet write the code for the body of the method.
  • In the method run, in the class Checks, create an instance of CheckerBuggle.
    --Invoke the new method (the one that you are writing) on this instance of CheckerBuggle.
    --Compile and run the program. Since there is nothing in the body of the method yet, you should only see the new buggle on the applet, but no drawing.
  • Go back to fill in the body of the method.
    -- As you are writing the code, compile and run your program after adding a couple of lines. This way you can discover and correct any errors immediately.
  • The very first line of code in your method (note: in your method, not in your program) should look like this:

    System.out.println("Just inside blahblah method");

    where blahblah is the name of your newly created method.
    This allows your Java program to leave a trace, a trail of crumbs, so to speak. Each time that line of code is executed, the words between the double quotes will print to the console pane (lower pane in DrJava). As your programs get more complex, these print statements will come in very handy.