Tutorial on Variation II
Richard Bosworth
November 21, 2005
Aims
• to explore the ways in which variation can be expressed in designs
• to give practice in using the Default, Flyweight and Singleton patterns
• to encourage the student’s creativity in designing interfaces
Scenario
A new game is being produced which runs onWindows, Unix and Mac platforms.
For each platform there is a Beginners and an Advanced version.
Exercises
In the following exercises, do not write code. Draw UML diagrams, or just give
the method specifications (method signature and pres/posts).
1. The advanced game has 42 different kinds of warrior, who can each use a
selection of 10 weapons together or in combination. There are 14 levels of
play, each of which can take place in eight different environments. There
can be thousands of warriors in any one instantiation of the game.
Nevertheless, all the warrior’s attributes are either fixed for that type of
warrior or dependent on which weapon he or she is carrying and which
environment he or she is currently battling in.
Decide on an appropriate design for the warriors, and sketch the interfaces
and classes you would use to implement it.I had a go at part of question 1, here it is, how does it look?
i didn't do all the wierd little pointer endings on the links right but they're a little trivial to me at the moment, as I can't get the gist of it anyway, i'll do it right once I know what i'm doing.
