Game Development Reference
In-Depth Information
Figure 43.2
Modified version of the
Model-View-Controller pattern.
The variation will still require that the controller know the type of views and
model used, but we should be able to build a system where a view does not need
to know the type of model being observed. You may be wondering why a view does
not know about the controller sending commands to it. This is so there are as few
dependencies as possible, making it easy to swap controllers in and out of the sys-
tem without breaking any references.
A Simple Object Model Architecture
Microsoft Word is an excellent case study when studying object models, but cov-
ering the entire design would be a complete topic in itself. Instead, I will give you
a very small overview of a small subset of the object model so that hopefully you
will understand the way the object model in Word is designed. After that I will dis-
cuss the small object model that the example in this chapter employs, along with
some of the more important code snippets.
The root of the Microsoft Word object model starts with the Application class,
which is basically a singleton that provides access to all the toolbars, documents,
windows, menus, status bars, alerts, dialogs, and so forth. The entire application
can be accessed by this singleton, which can do things like manipulate content in
documents, change menu labels, update a status bar, click user interface elements
such as buttons, add command bars, and so forth. As an example, you can display
an open file dialog by calling Application.Documents.Open() . If you need to change
a value such as the title of the document, you do not have to worry about executing
Search Nedrilad ::

Custom Search