Discussion of GRASP Patterns (Interact with Object)
- Due 3 Feb 2023 by 14:00
- Points None
The following pages may be of use for this assignment:
- Before you begin: DON'T PANIC!
- Assignment Input: System Description
- Assignment Input: Domain Model
- Assignment Input: Detailed Use Case (Interact with Object) + System Sequence Diagram
- Example of Discussions of GRASP patterns (Interact with Character)
- Module: Understanding the Problem Domain
- Module: Object Oriented Design
- Module: Problem Based Design
From a system sequence diagram, we get a number of system events (method calls from "Player" to ":Game"). In order for the system to actually be able to deliver what is expected as a response to each of these system events, a number of domain concepts (from the domain model) need to interact. Moreover, you need to create several other classes to help you find, deliver, and interact with these domain concepts.
For each of the system events, we can get an early idea of what is required and how to set up the interaction if we consider the domain model from the perspective of GRASP patterns.
Note that this assignment is not marked and not submitted. The intention is for you to think about the questions below, and then use this when doing the next assignment Interaction Diagrams (Interact with Object). There, it will be visible and obvious to us how much you have thought about the questions below.
Task: First, consider again the Assignment Input: Detailed Use Case (Interact with Object) + System Sequence Diagram and the Assignment Input: Domain Model. Then, please answer the questions posed below.
selectObject(theGameObject)
This event starts this use case, and finds the game object to interact with.
- Who is the information expert on what game objects are available?
- Who is the controller for this use case?
- Who is the information expert on the InteractionTypes that are available for a particular GameObject?
selectInteraction(theInteractionType)
During this event, the system needs to find out what InteractionTypes that are available for the selected GameObject.
- Who should be the creator of an :InteractionType object?
- Who is the information expert on the interaction specific options that may be available for this particular InteractionType?
- Who is responsible for formatting these options to something which can be displayed in the user interface?
setInteractionOptions(theOptions)
This event means that the system needs to send the options given by the player to the previously selected interactionType.
- Should ":Game" set the options directly on the :InteractionType object, or should it pass it along via a method on the :GameObject object?
Discuss your answer in terms of low coupling and high cohesion.
startInteraction()
With this event we start the interaction with the given options. As an end result we may have created new events, and we may have an updated persistent state for the :GameObject.
- Who is the controller for the actual interaction to be executed with the :GameObject (Beware: it's not the most obvious one, so think twice before answering)?
- By which GRASP pattern may we get a class responsible for handling persistent storage?
- Who is responsible for generating new events? Reason about how or if you may get lower coupling by assigning this responsibility to different classes.
- Who should be the controller for taking care of new events and enqueuing them for later dispatch?