Chapter 5: System Modeling
Chapter 5: System Modeling
1
Objectives
•Understand how graphical models can be used to represent Software
systems and why several types of model are needed to Fully represent a
system;
•Understand the fundamental system modeling perspectives of Context,
interaction, structure, and behavior;
•Understand the principal diagram types in the unified modeling Language
(UML) and how these diagrams may be used in system Modeling;
•Have been introduced to model-driven engineering, where an Executable
system is automatically generated from structural and Behavioral models.
2
Topics Covered
• Introduction to System Modeling
•Context models
•Interaction models
•Structural models
•Behavioral models
•Model-driven engineering
3
System modeling
4
Existing and planned system models
5
Models can explain the system from different perspectives:
6
Five types of UML diagrams that are the most useful for system modeling:
7
1. Context models
• Architectural models show the system and its relationship with other
systems.
8
• System boundaries are established to define what is inside and what is
outside the system.
• They show other systems that are used or depend on the system being
developed.
• The position of the system boundary has a profound effect on the system
requirements.
9
• This system is intended to manage information about patients attending
mental health clinics and the treatments that have been prescribed.
• You have to decide whether the system should focus exclusively on
collecting information about consultations (using other systems to collect
personal information about patients) or whether it should also collect
personal patient information.
• The advantage of relying on other systems for patient information is that
you avoid duplicating data.
• The major disadvantage, however, is that using other systems may make it
slower to access information, and if these systems are unavailable.
10
Figure 5.1.The context of the MHC-PMS
11
Process perspective
•Context models simply show the other systems in the environment, not how the
system being developed is used in that environment.
•Process models reveal how the system being developed is used in broader
business processes.
•Arrows represent the flow of work from one activity to another, and a solid bar
indicates activity coordination, condition checks, start of process, process
termination.
12
Process model of involuntary detention
Figure 5.2. Activity diagram that show where the Mentcare system is used in an important mental health care
13
process—involuntary detention.
2. Interaction models
• Use case diagrams and sequence diagrams may be used for interaction
modeling.
14
Use case modeling
•Use case modeling, which is mostly used to model interactions between a
system and external agents (human users or other systems).
•Each use case represents a discrete task that involves external interaction with
a system.
•We are quite familiar with Use Cases and their models.
15
Figure 5.3.Transfer-data use case
• Use case diagrams give a simple overview of an interaction, and you need
to add more detail for complete interaction description. This detail can
either be a simple textual description, a structured description in a table,
or a sequence diagram.
• Tabular description of the “Transfer data” use case as below.
16
Figure 5.4. Tabular description of the Transfer-data use case
17
• Composite use case diagrams show a number of different use cases.
Sometimes it is possible to include all possible interactions within a system
in a single composite use case diagram.
• In such cases, you may develop several diagrams, each of which shows
related use cases.
• Following figure shows all of the use cases in the Mentcare system in
which the actor “Medical Receptionist” is involved with more detailed
description.
18
Figure 5.5. Use cases involving the role “Medical receptionist”
19
Sequence diagrams
•Sequence diagrams are part of the UML and are used to model the
interactions between the actors and the objects within a system and the
interactions between the objects themselves.
20
Figure 5.6. Sequence diagram for View patient information
21
• The medical receptionist triggers the ViewInfo method in an instance P of the
PatientInfo object class, supplying the patient’s identifier, PID to identify the
required information. P is a user interface object, which is displayed as a form
showing patient information.
• The instance P calls the database to return the information required, supplying the
receptionist’s identifier to allow security checking. (At this stage, it is not important
where the receptionist’s UID comes from.)
• The database checks with an authorization system that the receptionist is authorized
for this action.
• If authorized, the patient information is returned and is displayed on a form on the
user’s screen. If authorization fails, then an error message is returned. The box
denoted by alt in the top-left corner is a choice box indicating that one of the
contained interactions will be executed. The condition that selects the choice is
shown in square brackets.
22
Figure 5.7. Sequence diagram for Transfer Data 23
• Sequence diagram from the same system that illustrates two additional features. These
are the direct communication between the actors in the system and the creation of
objects as part of a sequence of operations.
• This example, an object of type Summary is created to hold the summary data that is
to be uploaded to a national PRS (patient records system).
24
4. Personal information may be transferred directly from the user interface object to the
PRS. Alternatively, a summary record may be created from the database, and that
record is then transferred.
5. On completion of the transfer, the PRS issues a status message and the user logs off.
25
3. Structural models
• Structural models may be static models, which show the structure of the
system design, or dynamic models, which show the organization of the
system when it is executing.
• You create structural models of a system when you are discussing and
designing the system architecture.
• The structure model never describes the dynamic behavior of the system,
So, class diagram widely used.
26
Class diagrams
• When you are developing models during the early stages of the software
engineering process, objects represent something in the real world, such as
a patient, a prescription, doctor, etc.
27
Figure 5.8. Multiplicity
28
Figure 5.10. Classes and associations in the Mentcare system
29
Figure 5.11. A Consultation class
30
Generalization
31
Generalization
• In modeling systems, it is often useful to examine the classes in a system to see if
there is scope for generalization. If changes are proposed, then you do not have to
look at all classes in the system to see if they are affected by the change.
• The lower-level classes are subclasses inherit the attributes and operations from
their super classes. These lower-level classes then add more specific attributes and
operations.
32
Figure 5.12. A generalization hierarchy
33
Figure 5.13. A generalization hierarchy with added detail
34
Object class Aggregation models
36
4. Behavioral models
37
Data-driven modeling
• Many business systems are data-processing systems that are primarily driven
by data.
• They are controlled by the data input to the system, with relatively little
external event processing. Their processing involves a sequence of actions on
that data and the generation of an output.
• For example, a phone billing system will accept information about calls made
by a customer, calculate the costs of these calls, and generate a bill for that
customer.
• This is also know as Data-flow diagrams(DFDs) can be represented in the
UML using the activity diagram type.
38
Figure 5.15. Order processing DFD
39
• Data-flow models are useful because tracking and documenting how data
associated with a particular process moves through the system help analysts
and designers understand what is going on in the process.
• Figure 5.15 shows simple activity diagram that shows the chain of processing
involved in the insulin pump software.
• Activities represented as (rounded rectangles),and the data flowing between
these steps, represented as objects (rectangles).
• An alternative way of showing the sequence of processing in a system is to use
UML sequence diagrams.
• Figure 5.16 illustrates this, using a sequence model of processing an order and
sending it to a supplier.
40
Figure 5.16. Order processing
41
Event-driven modeling
• It is based on the assumption that a system has a finite number of states and
that events (stimuli) may cause a transition from one state to another.
42
State machine models
•These model the behavior of the system in response to external and internal
events.
•They show the system’s responses to stimuli so are often used for modeling
real-time systems.
•State machine models show system states as nodes and events as arcs
between these nodes. When an event occurs, the system moves from one
state to another.
•State charts are an integral part of the UML and are used to represent state
machine models.
43
Figure 5.17. A State diagram of a microwave oven
44
States and stimuli for the microwave oven (a)
State Description
Waiting The oven is waiting for input. The display shows the current time.
Half power The oven power is set to 300 watts. The display shows ‘Half power’.
Full power The oven power is set to 600 watts. The display shows ‘Full power’.
Set time The cooking time is set to the user’s input value. The display shows
the cooking time selected and is updated as the time is set.
Disabled Oven operation is disabled for safety. Interior oven light is on. Display
shows ‘Not ready’.
Enabled Oven operation is enabled. Interior oven light is off. Display shows
‘Ready to cook’.
Operation Oven in operation. Interior oven light is on. Display shows the timer
countdown. On completion of cooking, the buzzer is sounded for five
seconds. Oven light is on. Display shows ‘Cooking complete’ while
buzzer is sounding.
45
States and stimuli for the microwave oven (b)
Stimulus Description
Half power The user has pressed the half-power button.
46
Figure 5.18. A state model of the Operation state
47
Model-driven engineering
48
Usage of model-driven engineering
• Pros
• Allows systems to be considered at higher levels of abstraction
• Generating code automatically means that it is cheaper to adapt systems to new
platforms.
• Cons
• Models for abstraction and not necessarily right for implementation.
• Savings from generating code may be outweighed by the costs of developing
translators for new platforms.
49
Model driven architecture
50
Types of model
Computation independent model (CIM)
•These model the important domain abstractions used in a system
•Also called domain model / business model
Platform independent model (PIM)
•Model the operation / functionality of the system without implementation
•The PIM is usually described using UML models that show the static system
structure and how it responds to external and internal events.
•Also called design model
Platform specific models (PSM)
•Implementation model.
•These are transformations of the platform-independent model with a separate
PSM for each application platform.
•Each layer adding some platform-specific detail. 51
Figure 5.19. MDA transformations
52
Figure 5.20. Multiple model platform-specific models
53
Solve the following questions
Q. Develop a sequence diagram showing the interactions involved when a student registers for a course in a
university. Courses may have limited enrollment, so the registration process must include checks that places are
available. Assume that the student accesses an electronic course catalog to find out about available courses
Q. Draw a UML class diagram to capture the following situation: “Every student is enrolled in a course. Each
student may be enrolled in a set of units. Some units are core units for one or more courses and some units are
elective units for one or more courses.”
Q. Based on your experience with a bank ATM, draw an activity diagram that models the data processing
involved when a customer withdraws cash from the machine
Q. Draw a sequence diagram for the same system. Explain why you might want to develop both activity and
sequence diagrams when modeling the behavior of a system.
Q. Represent the following relations among classes using UML diagram.
1.Students credit 5 courses each semester. Each course is taught by one or more teachers.
2.Bill contains number of items. Each item describes some commodity, the price of unit, and total on this price.
3.An order consists of one or more order items. Each order item contains the name of the item, its quantity and
the date by which it is required. Each order item is described by an item type specification object having details
such as its vendor addresses, its unit price, and the manufacturer.
54
Thank you
55