I see many of you wasting large blocks of time on debugging. As you already know, the
requirements of this class are such that you cannot afford to waste any time. Below are
my suggestions for debugging. I have been programming for 35 years! While I don't
pretend to have all the answers, these techniques work! Give them a try.
1) If you are asking someone for help getting started, show them your attempts at a
solution. You may be totally wrong, but at least the tutor can see quickly where you
2) After you finish entering your code, get a printed copy and read it. You are not
looking for syntax errors, but for logic errors. You want to see the logical
functioning at a higher level. This simple practice can save you an hour of debugging
per program. You can find several mistakes in a few minutes.
3) Program defensively. Write an assert routine such as
public class BadData extends Exception
public BadData(String msg)
public void assert(boolean b,String msg)