CSC 309 Lecture Notes Weeks 6 and 7
Design Refinement
Introduction to Code Coverage Measures
public class SomeModelClass
    extends Model {
     ...
}
model = new SomeModelClass(); /* Put some data in model ... */ FileOutputStream outFile = new FileOutputStream( "model.dat"); ObjectOutputStream outStream = new ObjectOutputStream(outFile); outStream.writeObject(model);
FileInputStream inFile =
    new FileInputStream("model.dat");
ObjectInputStream inStream =
    new ObjectInputStream(inFile);
model = (SomeModelClass)
    inStream.readObject();
public class View implements Observer {
        . . .
}
public class Model extends Observable implements Serializable {
        . . .
}
public class UserCalendar extends Model {
     . . .
    public void add(ScheduledItem item) {
        . . .
        items.add(item);
        setChanged();
    }
}
 . . .
public class OKScheduleEVentButtonListener implements ActionListener {
    public void actionPerformed() {
        try {
            schedule.scheduleEvent(
                new caltool.schedule.Event(
                    ...
                )
            );
        }
        . . .
        schedule.notifyObservers();
        . . .
    }
}
 . . .
public class MonthlyAgenda extends View {
    public MonthlyAgenda(caltool.view.View view, UserCalendar userCalendar) {
        . . .
        userCalendar.addObserver(this)
    }
    public void update(Observable o, Object arg) {
        /* Get items for this month from MonthylyAgenda model and update display */
    }
}
-- Now onto Some General Topics of Design Refinement --
-- And Finally, a Brief Introduction to Code Coverage
With More to Follow in the Week 8 Lecture Notes