You are on page 1of 16

2/24/2023

Topics covered

◇Context models
System Modeling
◇Interaction models
◇Structural models
◇Behavioural models
◇Model-driven engineering
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 369 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 370

System modeling Existing and planned system models

◇System modeling is the process of developing ◇ Models of the existing system are used during requirements
abstract models of a system, with each model engineering.
presenting a different view or perspective of that ▪ They help clarify what the existing system does and can be used as a
basis for discussing its strengths and weaknesses.
system. ▪ These then lead to requirements for the new system.
◇S y s t e m m o d e l i n g h a s n o w c o m e t o m e a n ◇ Models of the new system are used during requirements
representing a system using some kind of graphical engineering to help explain the proposed requirements to
other system stakeholders.
notation, which is now almost always based on ▪ Engineers use these models to discuss design proposals and to
notations in the Unified Modeling Language (UML). document the system for implementation.

◇System modelling helps the analyst to understand ◇ In a model-driven engineering process, it is possible to
generate a complete or partial system implementation from the
the functionality of the system and models are used system model.
to communicate with customers.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 371 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 372

1
2/24/2023

System perspectives UML diagram types

◇ An external perspective, where you model the context or ◇ Activity diagrams, which show the activities involved in
environment of the system. a process or in data processing.
◇ An interaction perspective, where you model the ◇ Use case diagrams, which show the interactions between
interactions:
▪ between a system and its environment, or
a system and its environment.
▪ between the components of a system. ◇ Sequence diagrams, which show interactions between
◇A structural perspective, where you model the actors and the system and between system components.
organisation of a system or the structure of the data ◇ Class diagrams, which show the object classes in the
that is processed by the system. system and the associations between these classes.
◇ A behavioural perspective, where you model the
dynamic behaviour of the system and how it responds to ◇ State diagrams, which show how the system reacts to
events. internal and external events.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 373 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 374

Use of graphical models Context models

◇As a means of facilitating discussion about an ◇Context models are used to illustrate the
existing or proposed system operational context of a system - they
▪Incomplete and incorrect models are OK as their role show what lies outside the system
is to support discussion. boundaries.
◇As a way of documenting an existing system ◇Social and organisational concerns may
▪Models should be an accurate representation of the
affect the decision on where to position
system but need not be complete.
system boundaries.
◇As a detailed system description that can be
used to generate a system implementation ◇Architectural models show the system
▪Models have to be both correct and complete. and its relationship with other systems.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 375 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 376

2
2/24/2023

System boundaries The context of the MHC-PMS

◇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.
◇Def inin g a s y s t e m b o u n d a r y i s a p o l i t i c a l
judgment
▪T h e r e m a y b e p r e s s u r e s t o d e v e l o p s y s t e m
boundaries that increase / decrease the influence or
workload of different parts of an organisation.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 377 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 378

Process perspective
Process perspective UML Activity Diagram Symbols

◇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.
◇UML activity diagrams may be used to
define business process models.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 379 source:
Ian www.educba.com
©380 Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract)

3
2/24/2023

Process model (activity diagram) of involuntary


Process perspective
detention

◇ UML activity diagrams may be


used to define business process
models.
◇The next slide shows a UML activity
diagram describing the process of
involuntary detention and the role of MHC-
PMS (mental healthcare patient
management system) in it.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 381 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 382

Interaction models Use case modeling

◇Modeling user interaction is important as it helps to ◇Use cases were developed originally to support
identify user requirements. requirements elicitation and are now incorporated
◇Modeling system-to-system interaction highlights into the UML.
the communication problems that may arise. ◇Each use case represents a discrete (distinct) task
◇M o d e l i n g c o m p o n e n t i n t e r a c t i o n h e l p s u s that involves external interaction with a system.
understand if a proposed system structure is likely ◇Actors in a use case may be people or other
to deliver the required system performance and systems.
dependability. ◇Represented
▪Emergent properties… ▪diagramatically to provide an overview of the use case
◇Use case diagrams and sequence diagrams may and
be used for interaction modeling. ▪in a more detailed textual form.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 383 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 384

4
2/24/2023

Tabular description of the ‘Transfer data’ use-


Transfer-data use case
case
MHC-PMS: Transfer data
◇ A use case in the MHC-PMS Actors Medical receptionist, patient records system (PRS)

Description A receptionist may transfer data from the MHC-PMS to a


general patient record database that is maintained by a
health authority. The information transferred may either
be updated personal information (address, phone
number, etc.) or a summary of the patient’s diagnosis
and treatment.

Data Patient’s personal information, treatment summary

Stimulus User command issued by medical receptionist


Response Confirmation that PRS has been updated
Comments The receptionist must have appropriate security
permissions to access the patient information and the
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 385 © Ian Sommerville
PRS. 386
Software Engineering, 9th ed. Chapter 5 System Modelling (extract)

Use cases in the MHC-PMS involving the role


Sequence diagrams
‘Medical Receptionist’

◇Sequence diagrams are part of the UML and show


object interactions arranged in a time sequence
▪interactions are the exchange and interplay of
messages among participants in some useful
behavior.
▪An interaction is a unit of behaviour that focuses
on the exchange of information between
connectable elements.
◇The flow of events can be used to determine what
objects and interactions are required to accomplish
the functionality.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 387 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 388

5
2/24/2023

Sequence diagram Sequence diagram for View patient information


The objects and actors involved are listed along the top of the diagram, with a
dotted line drawn vertically from these.
Interactions between objects are indicated by annotated arrows.

source: www.sciencedirect.com

389 390
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract)

Sequence diagram for Transfer Data


Sequence diagrams

◇Model the interactions between the actors and the


objects within a system.
◇Show the sequence of interactions that take place
during a particular use case or use case instance.
◇Very useful tools at the start of a project as they
show the user what has to happen in a step-by-step
fashion.
◇Excellent for
▪depicting what's going on
▪extracting requirements
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 391 ▪interacting with customers. 392
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract)

6
2/24/2023

Structural models

◇S t r u c t u r a l m o d e l s o f s o f t w a r e d i s p l a y t h e
Context models organisation of a system in terms of the
components that make up that system and their
Interaction models relationships.
◇Structural models may be
Structural models ▪static models, which show the structure of the system
design, or
▪dynamic models, which show the organisation of the
Behavioural models system when it is executing.
◇You create structural models of a system when you
Model-driven engineering are discussing and designing the system
© Ian Sommerville
architecture.
© Ian Sommerville 394
Software Engineering, 9th ed. Chapter 5 System Modelling (extract)
393 Software Engineering, 9th ed. Chapter 5 System Modelling (extract)

Class diagrams UML classes and association

◇Class diagrams are used when developing an


object-oriented system model to show the classes in
a system and the associations between these
classes.
▪An object class can be thought of as a general definition
of one kind of system object.
▪An association is a link between classes that indicates
that there is some relationship between these classes.
◇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.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 395 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 396

7
2/24/2023

Classes and associations in the MHC-PMS The Consultation class

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 397
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 398

Key points

◇ A model is an abstract view of a system that ignores system details.


Complementary system models can be developed to show the
system’s context, interactions, structure and behaviour.
Chapter 5 – System Modeling
◇ Context models show how a system that is being modeled is
positioned in an environment with other systems and processes.
◇ Use case diagrams and sequence diagrams are used to describe
the interactions between users and systems in the system being Lecture 2
designed. Use cases describe interactions between a system and
external actors; sequence diagrams add more information to these by
showing interactions between system objects.
◇ Structural models show the organisation and architecture of a
system. Class diagrams are used to define the static structure of
classes in a system and their associations.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 399 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 400

8
2/24/2023

Generalisation Generalisation

◇ Generalisation is an everyday technique that we use to ◇ In modeling systems, it is often useful to examine the classes in a
system to see if there is scope for generalisation.
manage complexity. ▪ If changes are proposed, then you do not have to look at all classes in the
◇ Rather than learn the detailed characteristics of every system to see if they are affected by the change.
entity that we experience, we place these entities in more ◇ In object-oriented languages, such as Java, generalisation is
general classes (animals, cars, houses, etc.) and learn implemented using the class inheritance mechanisms built into
the characteristics of these classes. the language.
◇ In a generalisation, the attributes and operations associated with
◇ This allows us to infer that different members of these
higher-level classes are also associated with the lower-level
classes have some common characteristics e.g. moles classes.
and rats are rodents.
◇ The lower-level classes are subclasses and inherit the
attributes and operations from their superclasses.
▪ These lower-level classes then add more specific attributes and operations.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 401 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 402

A generalisation hierarchy A generalisation hierarchy with added detail

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 403 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 404

9
2/24/2023

Object class aggregation models The aggregation association

◇An aggregation model shows how


classes that are collections are
composed of other classes.
◇Aggregation models are similar to
the part-of relationship in
semantic data models.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 405 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 406

Behavioural models Data-driven modeling

◇ Behavioural models are models of the dynamic ◇Many business systems are data-processing
behaviour of a system as it is executing. systems that are primarily driven by data.
▪ They show what happens or what is supposed to happen when a
system responds to a stimulus from its environment.
▪They are controlled by the data input to the system,
with relatively little external event processing.
◇ You can think of these stimuli as being of two types:
▪ Data ◇Data-driven models show the sequence of
• Some data arrives that has to be processed by the system. actions involved in processing input data and
▪ Events generating an associated output.
• Some event happens that triggers system processing.
• Events may have associated data, although this is not always the ◇They are particularly useful during requirements
case.
analysis as they can be used to show end-to-
– Real-time systems are often event-driven, with minimal data
processing. end processing in a system.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 407 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 408

10
2/24/2023

An activity model of the insulin pump’s operation Order processing

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 409 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 410

Event-driven modeling State machine models

◇ These model the behaviour of the system in response to external and


◇ Real-time systems are often event-driven, with minimal internal events.
data processing. ◇ Sometimes known as state machine diagrams.
▪ For example, a landline phone switching system responds to
◇ Show transitions between various objects.
events such as ‘receiver off hook’ by generating a dial tone.
◇ They show the system’s responses to stimuli
◇ Event-driven modeling shows how a system responds to ▪ thus often used for modelling real-time systems.
external and internal events. ◇ State machine models show
◇ It is based on the assumption that a system has a finite ▪ system states as nodes and
▪ events as arcs between these nodes.
number of states and that events (stimuli) may cause a
transition from one state to another. ◇ 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.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 411 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 412

11
2/24/2023

State diagram / State Chart of a microwave oven 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.

‘Not ready’
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 413 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 414

States and stimuli for the microwave oven (b) Microwave oven operation

Stimulus Description
Half power The user has pressed the half-power button.

Full power The user has pressed the full-power button.


Timer The user has pressed one of the timer buttons.

Number The user has pressed a numeric key.


Door open The oven door switch is not closed.
Door closed The oven door switch is closed.
Start The user has pressed the Start button.
Cancel The user has pressed the Cancel button.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 415 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 416

12
2/24/2023

Model-driven engineering Usage of model-driven engineering

◇ Model-driven engineering (MDE) is an approach to ◇ Model-driven engineering is still at a relatively early stage
software development where the principal outputs of the of development
development process are models rather than programs. ▪ it is unclear whether or not it will have a significant effect on
software engineering practice.
◇ The programs that execute on a hardware/software
◇ Pros
platform are then generated automatically from the
▪ Allows systems to be considered at higher levels of abstraction
models. ▪ Generating code automatically means that it is cheaper to adapt
◇ Proponents of MDE argue that this raises the level of systems to new platforms.
abstraction in software engineering ◇ Cons
▪ engineers no longer have to be concerned with programming ▪ Models for abstraction and not necessarily right for implementation.
language details or the specifics of execution platforms. ▪ Savings from generating code may be outweighed by the costs of
developing translators for new platforms.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 417 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 418

Types of Model Driven Development (MDD)


Model driven architecture System Models

◇ Model-driven architecture (MDA) was the precursor of ◇In Model-Driven Development


more general model-driven engineering
◇ MDA
(MDD) we build three models of
▪is a model-focused approach to software design and the system:
▪CIM = Computation-Independent
implementation
▪ uses a subset of UML models to describe a system.
◇ Models at different levels of abstraction are created. Model
▪ From a high-level, platform independent model, it is possible, in
principle, to generate a working program without manual ▪PIM = Platform-Independent Model
▪PSM = Platform-Specific Model
intervention.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 419 420
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract)

13
2/24/2023

Types of Model Driven Development (MDD) Types of Model Driven Development (MDD)
System Models System Models

◇ Computation independent model (CIM) ◇ A Platform Independent Model (PIM)


▪ Models the important domain abstractions used in a system. ▪ Exhibits enough independence to enable it to be mapped to one
▪ Often aka domain/business models as they use a vocabulary or more platforms.
that is familiar to the subject matter experts. ▪ We usually achieve this by defining a set of services in a way that
▪ Present exactly what the system is expected to do, but hides all abstracts out technical details.
IT related specifications.
▪ We then come up with other models to specify a realisation of
▪ This enables them to remain independent of how that system will
be (or currently is) implemented. these services in a platform specific way.
▪ Play an important role in bridging the gap which typically exists ▪ Models the operation of the system without reference to its
between these domain experts and the software engineer implementation.
responsible for implementing the system. ▪ We usually describe the PIM using UML models that show
▪ In an MDA specification the CIM requirements should be • the static system structure and
traceable to the PIM and PSM constructs that implement them • how it responds to external and internal events.
(and vice-versa).

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 421 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 422

Types of Model Driven Development (MDD)


Types of MDD Models
System Models

◇ Analysis phase goal: to produce the CIM.


◇ A Platform specific model (PSM)
▪ Transformations of the platform-independent model. ◇ Design phase goal: to produce the PIM.
▪ A separate PSM for each application platform. ◇ Implementation phase goal: to produce the PSM.
▪ In principle, there may be layers of PSM, with each layer adding ◇ Example:
some platform-specific detail.
▪ Combines the specifications in the PIM with the details laying ◇ A CIM/domain model can be a statechart diagram that
down how a system uses a particular type of platform. combines the statechart diagrams for all use cases as
▪ An abstract PSM is one that does not include all of the details macro or submachine states.
necessary to produce an implementation of that platform. ▪ A macro state is a state that contains micro states and transitions.
• it relies on other explicit or implicit models which do contain the
necessary details.
◇ The following slide depicts the CIM for an ATM:

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 423 424
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract)

14
2/24/2023

A Computation Independent Model (activity diagram) for an ATM A Computation Independent Model (statechart diagram) for an ATM

425 426

MDA transformations Multiple platform-specific models

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 427 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 428

15
2/24/2023

Agile methods and MDA Executable UML

◇MDA’s developers claim that it is intended to


support an iterative approach to development. ◇T h e f u n d a m e n t a l n o t i o n b e h i n d
▪thus can be used within agile methods. model-driven engineering is that
◇H o w e v e r , t h e e x t e n s i v e u p - f r o n t m o d e l i n g completely automated transformation
contradicts the fundamental ideas in the agile of models to code should be possible.
manifesto.
◇I n t h e o r y , M D A c o u l d b e u s e d i n a n a g i l e
◇This is possible using a subset of
development process if transformations can be UML 2, called Executable UML or
completely automated and a complete program xUML.
generated from a PIM
▪as no separate coding would be required.
© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 429 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 430

Features of executable UML Key points

◇To create an executable subset of UML requires ◇ Behavioural models are used to describe the dynamic
behaviour of an executing system.
3 model types: ▪ This behaviour can be modeled from the perspective of the data
▪Domain models (CIM) that identify the principal processed by the system, or by the events that stimulate responses from
a system.
concerns in a system. ◇ Activity diagrams may be used to model the processing of data,
• Defined using UML class diagrams and include objects, where each activity represents one process step.
attributes and associations. ◇ State diagrams are used to model a system’s behaviour in
▪Class models in which classes are defined, along with response to internal or external events.
their attributes and operations. ◇ Model-driven engineering is an approach to software
▪State models in which a state diagram is associated development in which a system is represented as a set of
models that can be automatically transformed to executable
with each class and is used to describe the life cycle of code.
the class.

© Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 431 © Ian Sommerville Software Engineering, 9th ed. Chapter 5 System Modelling (extract) 432

16

You might also like