Page 148 -
P. 148
5.3 Structural models 131
Consultation
Doctors
Date
Time
Clinic
Reason
Medication Prescribed
Treatment Prescribed
Voice Notes
Transcript
...
New ( )
Prescribe ( )
RecordNotes ( )
Transcribe ( )
Figure 5.10 The ...
consultation class
(they have no operations), attributes as object class attributes and relations as named
associations between object classes.
When showing the associations between classes, it is convenient to represent
these classes in the simplest possible way. To define them in more detail, you add
information about their attributes (the characteristics of an object) and operations
(the things that you can request from an object). For example, a Patient object will
have the attribute Address and you may include an operation called ChangeAddress,
which is called when a patient indicates that they have moved from one address to
another. In the UML, you show attributes and operations by extending the simple
rectangle that represents a class. This is illustrated in Figure 5.10 where:
1. The name of the object class is in the top section.
2. The class attributes are in the middle section. This must include the attribute
names and, optionally, their types.
3. The operations (called methods in Java and other OO programming languages)
associated with the object class are in the lower section of the rectangle.
Figure 5.10 shows possible attributes and operations on the class Consultation. In
this example, I assume that doctors record voice notes that are transcribed later to
record details of the consultation. To prescribe medication, the doctor involved must
use the Prescribe method to generate an electronic prescription.
5.3.2 Generalization
Generalization is an everyday technique that we use to manage complexity. Rather than
learn the detailed characteristics of every entity that we experience, we place these enti-
ties in more general classes (animals, cars, houses, etc.) and learn the characteristics of