29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Object</strong><br />

ApplicationModel<br />

Statement<br />

Fin<strong>an</strong>cialM<strong>an</strong>ager<br />

aFin<strong>an</strong>cialM<strong>an</strong>ager<br />

account<br />

aStatement<br />

Figure 27.7: Using <strong>an</strong> ApplicationModel with <strong>an</strong> domain object<br />

The objects involved in providing the applications functionality (or domain model) no longer need to<br />

be involved in the model hierarchy, they c<strong>an</strong> inherit from <strong>an</strong>y class in the system. For example, if we<br />

were to link our class Statement into this architecture we would do so as indicated in Figure 27.7. In<br />

this figure the classes are indicated by rect<strong>an</strong>gles <strong><strong>an</strong>d</strong> inst<strong>an</strong>ces by round cornered boxes.<br />

The approach of separating o ut ApplicationModel functionality is extremely powerful as we<br />

c<strong>an</strong> now develop the user interface <strong><strong>an</strong>d</strong> the system functionality completely separately. The following<br />

table summarizes this separation.<br />

application model<br />

domain model<br />

Provides user interface processing capabilities<br />

Provides system functionality<br />

The ApplicationModel class is actually the root of its own application model hierarchy. Figure<br />

27.8 illustrates part of this hierarchy. As c<strong>an</strong> be seen from this diag ram m<strong>an</strong>y of the graphical tools<br />

provided within VisualWorks are subclasses of ApplicationModel. For example, the user interface<br />

builder is provided by class such as UIBuilder, UIBuilderWatcher <strong><strong>an</strong>d</strong> UIPalette. The<br />

browsers are subclass of ApplicationModel as is the inspector, the ch<strong>an</strong>ges tool <strong><strong>an</strong>d</strong> the file<br />

browser. The graphical class browser used to display the class hierarchies is also a (user) defined<br />

subclass of ApplicationModel.<br />

Figure 27.8: Part of the ApplicationModel hierarchy<br />

27.6 Defining a window’s functionality<br />

We return now to the process of creating a window. So far we have defined the structure of the window<br />

but not yet how information is made available to the window (or obtained f orm the window), nor what<br />

happens when buttons are pressed etc. We have however defined the aspects for input fields (their<br />

228

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!