Design Patterns: Elements of Reusable Object-Oriented Software
Ho un problema con i diagrammi uml, prendendo per esempio la figura allegata, a quanto ho capito la freccia con la pallina rappresenta un associazione multipla e quindi maze giustamente mantiene piu riferimenti alle rooms (maze sa delle rooms ma le rooms non sanno di maze).
Quello che non capisco e lo stesso tipo di associazione tra room e mapsite che e una classe astratta...che senso ha?
Because the creational patterns are closely related, we’ll study all five of them together to highlight their similarities and differences. We’ll also use a common example—building a maze for a computer game— to illustrate their implementations. The maze and the game will vary slightly from pattern to pattern.
Sometimes the game will be simply to find your way out of a maze; in that case the player will probably only have a local view of the maze. Sometimes mazes contain problems to solve and dangers to overcome, and these games may provide a map of the part of the maze that has been explored.
We’ll ignore many details of what can be in a maze and whether a maze game has a single or multiple players. Instead, we’ll just focus on how mazes get created. We define a maze as a set of rooms. A room knows its neighbors; possible neighbors are another room, a wall, or a door to another room.
The classes Room, Door, and Wall define the components of the maze used in all our examples. We define only the parts of these classes that are important for creating a maze. We’ll ignore players, operations for displaying and wandering around in a maze, and other important functionality that isn’t relevant to building the maze.
The class MapSite is the common abstract class for all the components of a maze.
Each room has four sides.
The following diagram shows the relationships between these classes: