Page 308 -
P. 308
chaPter 10 • object-oriented systems analysis and design Using Uml 275
is now included in the browser JavaScript code or on the client side. This means that business
rules are included in both the boundary and the control class, so it might not be possible to have
three distinct layers.
Enhancing Class Diagrams
The class symbols also may be used on class and communication diagrams. Figure 10.16 illus-
trates a class diagram for a student viewing personal and course information on web pages. Each
class has attributes and methods (which are not shown on diagrams that use this notation).
If the class is a user interface type of class, the attributes are the controls (or fields) on the
screen or form. The methods would be those that work with the screen, such as submit or reset.
They might also be JavaScript for a web page because the code works directly with the web page.
If the class is a control class, the attributes would be those needed to implement the class,
such as variables used just in the control class. The methods would be those used to perform
calculations, make decisions, and send messages to other classes.
If the class is an entity class, the attributes represent those stored for the entity and the
methods working directly with the entity, such as creating a new instance, modifying, deleting,
obtaining, or printing.
A website may use a combination of many different classes to accomplish user objectives.
For example, a website may use JavaScript to prevalidate data, then pass data to the server con-
trol classes, which perform thorough validation, including obtaining data. The server control
classes may in turn send JavaScript back to the web page to do some formatting. It is not uncom-
mon to have a Web application involve many classes, some of them containing only one line of
code in a method, in order to achieve the goal of reusability.
Relationships
Another way to enhance class diagrams is to show relationships. Relationships are connections
between classes, similar to those found on an entity-relationship diagram. These are shown as
lines connecting classes on a class diagram. There are two categories of relationships: associa-
tions and whole/part relationships.
assoCiations. The simplest type of relationship is an association, or a structural connection
between classes or objects. Associations are shown as a simple line on a class diagram. The
end points of the line are labeled with a symbol indicating multiplicity, which is the same as
Figure 10.16
:View :View A class diagram for the
Student Student studentWebPage, using special
User Interface
Interface Controller class symbols.
Student
:Student :Section :Course
:Calculate
Grade
Point
Average