COMP 304B Object-Oriented Software Design - Assignment 5 Due date: Sunday March 30th, 2008 before 23:55
Practical information
Due date: March 30th
Team size == 2
Your submission must be in the form of a simple HTML file (index.html) with explicit references to all submitted
files as well as inline inclusion of images. See the general assignments page for an index.html template.
If working on this assignment as a team, each team submits only one full solution. The other team member must
submit a single index.html file containing only the coordinates of both team members. This will allow us to put
in grades for both team members in WebCT.
To get insight into the assignment workload, provide the number of hours you spent on this assignment.
The assignment
In this assignment, you will implement the Command Pattern for a very simple multi-body simulation system.
Most of the simulator code is provided (MultiBodySimulator.zip).
This includes a command line tool that interprets commands
you type in. Consider this tool as the invoker for your system. The syntax for the commands is as follows:
create : add a body to the multi-body system at position (0,0).
delete : remove a body from the multi-body system.
velocity : set a body's velocity vector to (v_x,v_y).
unit of velocity is unit of length/timestep
step : Advance the simulation of timesteps (default == 1).
undo : Undo the last commands (default == 1).
state : output the current state of the system.
help : Print this message.
quit : Quit this application.
Your task is to extend the design by means of the Command Pattern to support the undo command of the simulator.
The only commands which need undo are create, delete, velocity and step.
In particular, you should not undo the undo command (i.e., redo).
Note also that only succesful commands can be undone. Note also that step N is a composite command
and requires N undo commands to be fully undone.
This entails the following:
Draw a Class Diagram of the modified design. You may "collapse" some of the
classes which are already implemented: only show the attributes and methods you will need.
In your modified design, you should use meaningful names taken from the Command Pattern.
Draw a Sequence Diagram for the following sequence of commands (show only those messages pertinent to the Command Pattern):