Chapter 05-D System Modeling - Class Diagram
Chapter 05-D System Modeling - Class Diagram
In many cases, the UML diagrams simply replace the older structured
techniques (e.g., class diagrams replace ERD diagrams)
A structural model is a formal way of representing the objects that are used
and created by a business system. It illustrates people, places, or things
about which information is captured and how they are related to one another.
The structural model is drawn using an iterative process in which the model
becomes more detailed and less conceptual over time.
By building a structural model of the problem domain, the software engineer
creates the vocabulary necessary for the software engineer and users to
communicate effectively.
Classes
•Templates for instances of people, places, or
things
Attributes
•Properties that describe the state of an instance
of a class (an object)
Operations
•Actions or functions that a class can perform
Type
TarifSchedule
Table zone2price
Enumeration getZones()
Name Price getPrice(Zone)
TarifSchedule
zone2price Attributes Signature
getZones()
getPrice()
Operations TarifSchedule
For example, if we applied Text Analysis rules to the Make Old Patient Appt
use case described in the previous slide figure, we can easily identify
potential objects for an old patient, doctor, appointment, patient, office,
receptionist, name, address, patient information, payment, date, and time
We also can easily identify potential operations that can be associated with
the identified objects. For example, patient contacts office, makes a new
appointment, cancels an existing appointment, changes an existing
appointment, matches requested appointment times and dates with
requested times and dates, and finds current appointment.
As its name implies, a common object list is simply a list of objects common to the
business domain of the system.
Several categories of objects have been found to help the software engineer in making
the list, such as physical or tangible things, incidents, roles, and interactions.
Software Engineers should first look for physical, or tangible, things in the business
domain. These could include books, desks, chairs, and office equipment. Normally,
these types of objects are the easiest to identify. Incidents are events that occur in the
business domain, such as meetings, flights, performances, or accidents.
Reviewing the use cases can readily identify the roles that the people play in the
problem, such as doctor, nurse, patient, or receptionist.
Other types of objects that can be identified include places, containers, organizations,
business records, catalogs, and policies.
Finally, there are libraries of reusable objects that have been generated for different
business domains. For example, with regard to the appointment problem, the
Common Open Source Medical Objects could be useful to investigate for potential
objects that should be included. (See Common Open Source Medical Objects, Sourceforge,
sourceforge.net/projects/cosmos/.)
Chapter 5 System Modeling 19
Class Diagrams
Class diagrams represent the structure of the system in terms of classes and
objects
It is used as a basis for implementation, testing, and maintenance.
The class diagram is a static model shows the classes and the relationships
among the classes that remain constant in the system over time.
Elements of diagram include:
• Classes
• Attributes
• Methods
• Associations (Relationships)
Class is the main building block of a class diagram, which stores and
manages information in the system. During analysis, classes refer to the
people, places, events, and things about which the system will capture
information. Later, during design and implementation, classes can refer to
implementation-specific artifacts such as windows, forms, and other objects
Chapter 5 System Modeling 20
used to build the system
Elements of a Class Diagram
Class The main building block of a class diagram is the class, which stores and
manages information in the system.
Each class is drawn using a three part rectangle, with the class’s name at the top,
attributes in the middle, and operations at the bottom. We can see that the classes
identified earlier, such as Participant, Doctor, Patient, Receptionist, Medical History,
Appointment, and Symptom.
The attributes of a class and their values define the state of each object created from
the class, and the behavior is represented by the operations.
Attributes are properties of the class about which we want to capture information.
At times, you might want to store derived attributes, which are attributes that can be
calculated or derived; these special attributes are denoted by placing a slash (/) before
the attribute’s name, e.g., age is derived from date of birth
It is also possible to show the visibility of the attribute on the diagram. Visibility relates
to the level of information hiding to be enforced for the attribute. The visibility of an
attribute can be public (+), protected (#), or private (−).
In the previous chapter, we identified a set of use cases (Add an Apartment, Delete an
Apartment, and Search Available Rental Units) for the campus housing service that
helps students find apartments. By reviewing the use cases, we can easily determine
that the campus housing service must keep track of information for each available
apartment and its owner. The information to be captured for each apartment is the
location of the apartment, the number of bedrooms in the apartment, the monthly rent,
and how far the apartment is from the campus. Regarding the owner of the apartment,
we need to capture the owner’s contact information (e.g., name, address, phone
number, e-mail address). Since students are simply users of the system, there is no
need to capture any information regarding them; that is, in this case, students are
simply actors. Finally, with regards to relationships among the classes, there is a
single, optional, one to many association relationship that links the two classes
together.
owns
The library contains books and journals. It may have several copies of a
given book. Some of the books are reserved for short-term loans only.
All others may be borrowed by any library member for three weeks.
Members of the library can normally borrow up to six items at a time, but
members of staff may borrow up to 12 items at one time. Only members
of staff may borrow journals.
The system must keep track of when books and journals are borrowed and
returned and enforce the rules.
In this phase, you will make the analysis object model and dynamic model of the
system you proposed in Phase1 and 2. Make the following diagram.
1) Class Diagram:
Based on the use cases and problem statement you created in Phase 2, build a class
diagram to represent the entity, boundary, and control object types. Also show
relationships with multiplicities between the object types.