next up previous
Next: Roadmap Up: MeeshQuest Components Previous: Spatial Data Structure

Mediator

A Mediator is a design pattern that is described in the famous book Design Patterns by Gamma et Al, also referred to as the Gang of Four (GOF) book.[1]

The intent of a Mediator is to define an object that encapsulates how objects within a set interact. Mediator promotes a loose coupling among objects by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently3

In other words, the idea is to have one or more objects (hint: more!) which are capable of reading in commands from the input stream and executing them by calling the right functions in the dictionary, spatial, and adjacency list data structures (for Parts 2 and 3) to perform the requested action(s).

Minimally, the Mediator could be a class named CommandParser which would read commands from the standard input stream, parse the data, pass it onto the correct component for further processing, analyze the return values from this component, print the correct success or failure message back to the user, and then loop until all commands have been processed.

It would be wise (hint hint) to break this functionality into several classes which perform one or more of these tasks. These objects, when combined together, form the abstract notion of a Mediator for our MeeshQuest program.


next up previous
Next: Roadmap Up: MeeshQuest Components Previous: Spatial Data Structure
MM Hugue 2019-05-28