Notes on programming with good style by ___________________________

  1. How important is indentation to the correctness of a Java program?
  2. How does indentation make the meaning of a program easier to see?
  3. What do comments do?
  4. What should a good comment describe?
  5. Which parts of the code are perfect candidates to turn into methods?
  6. What are the 2 tools to make a program readable to a human?

Take this jumbled together program to walk around the island perimeter and rewrite it. Divide it into Jeroo methods, using indentation and comments.
Problem Description: Walk all the way around the perimeter of a square island with no obstacles starting in the northwest corner facing east and returning to the original position facing east.

method main()
Jeroo sally= new Jeroo();
while(!sally.isWater(AHEAD)){ sally.hop();}
sally.turn(RIGHT); while(!Sally.isWater(AHEAD)){
sally.hop();} sally.turn(RIGHT);
while(! sally.isWater(AHEAD)) {sally.hop();
} sally.turn(RIGHT);

sally.hop();} sally.turn(RIGHT);

This could be your the main method: (with Jeroo methods and comments added of course!)