"<LI>","<FONT","color # \"green\"",
The HtmlDOM , as it is implemented now, does not check the semantic
correctness of composition; for instance it is possible to add a Page into a
Link , which is clearly wrong. To enforce semantic correctness of composition
try to convert the notes in Figure 8.10 into code that checks the correctness
of the structure of the HTML page. This can be performed in two ways: first
by writing methods that statically verify whether the structure of the page
conforms to the constraints; second by modifying the existing methods in
order to check dynamically if any operation violates some constraints (hint:
in this case the add() operation is the only one that can perform violations).
Architectural style . The application is built around the internal representa-
tion of an HTML page. This is a typical example of data-centred architectural
style. A component (HTML DOM) is devoted to contain the data, while the
other components produce, modify and consume the data.
Generic component . The model that resulted from the analysis of the
problem, based on an example, was too specific. We derived a more generic
solution by using several patterns.
Communication mechanism . The communication between the components
is based on the method invocation.
Concurrency . Since the application performs a unique functionality, we
did not need any concurrency; the components work one at a time.
During the design phase of the first prototype we used several patterns: the
Class generalization and Delegation idioms, and the Composite design
pattern. These patterns are widely used in many similar cases. They should be
part of the everyday vocabulary of both system designers and programmers.
The implementation of the first prototype made use of the One-to-many
association idiom. The solution adopted in the design of the language front
end is an application of the pattern Observer . The architecture of the system
is simple because of the choice to adopt an internal representation that is
isomorphic to the output format.