Lab 7 : Design Patterns
Introduction
We start by quickly discussing the project proposals and the overall project organization.
In this lab we will try to finish the design patterns from the last week. Each should have already finished the exercises 0,1,2 and we start with 3.
Create a new project based on the latest simulator code
tp7-task0.zip. This time it is ready project that you can just import using the
File -> Import... -> General -> Existing Project into Workspace
. The project itself is in the
TP7
directory in the archive.
If time permits, we look at the dynamic Java and its ability to load classes at runtime.
Exercise 1: Mark the creature (Observer pattern and Decorator pattern and Delegation pattern)
Updated from the last lab
The task is to implement a new behavior that when user left clicks on a creature (when the simulation is stopped), it will change its appearance and additional circle will be drawn around it. One of the way to do it is to extend the
Visualizer
to raise an event every time it detects a user has clicked on a creature. The you should listen on this events in other class and decorate the creatures. Have a look at how the
CreatureInspector
is done. Only one create at a time can be selected.
to top