Graphics Reference
In-Depth Information
chooses a menu item, the controller is responsible for determining how the applica-
tion should respond.
Class Diagrams in UML
17.2.6
We explain class diagrams in Unified Modeling Language (UML), a tool for display-
ing class structure intuitively, for each design pattern described in the next section.
UMLisastandardlanguage forspecifying,visualizing, constructing, anddocument-
ing sotware systems, as well as for business modeling and other non-sotware sys-
tems (Hunt, ;Virius, ).UML uses mostly graphical notations to express the
design of sotware projects. UML . defines diagrams. hey are designed to let
developers and customersview a sotware system fromadifferent perspective and in
varying degrees of abstraction. We use only class diagrams among them to illustrate
design patterns in our Java graphics library.
Class diagrams describe types of objects in a system and their relationships. he
fundamental element of the class diagram is an icon that represents a class. his icon
is simply a rectangle divided into three compartments. he topmost compartment
contains the name of the class. he middle compartment contains a list of fields, and
the bottom compartment contains a list of methods. We usually show selected fields
and methods. In many cases, the bottom two compartments are empty.
Wecan addvisibility markerstosignifywhocanaccess theinformation contained
within a class. For example, private visibility (marked by - ) hides information from
anything outside the class partition, and public visibility (marked by + ) allows all
other classes to view the marked information.
If the operations are shown in italics, it indicates that they are purely virtual and
have no implementation there.
he inheritance relationship in a class diagram is depicted by a triangular arrow-
head.hisarrowheadpointstoasuperclassiconandthebaseofthearrowheadcomes
fromthesubclass(es)(seeFig. . ).
Aninterface isdepictedbyatriangular arrowheadwithabroken linesegment. We
add «interface» above the name of the interface (see Fig. . ). «interface»
is a stereotype in UML. Stereotypes provide a way of extending UML and produce
newkindsofmodelelements.Astereotypenameiswrittenabovetheclassnameand
is enclosed in guillemets.
Figure . . Inheritance in a class diagram
Search WWH ::




Custom Search