0% found this document useful (0 votes)
19 views

Lecture9 Process Models

The document covers system modeling in software engineering, detailing various types of models such as context, interaction, structural, and behavioral models, primarily using Unified Modeling Language (UML). It explains the purpose of UML diagrams, including activity, class, sequence, and use case diagrams, and their role in visualizing system architecture and user interactions. Additionally, it discusses the importance of modeling for understanding system functionality and facilitating communication among stakeholders.

Uploaded by

ajmalumar085
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Lecture9 Process Models

The document covers system modeling in software engineering, detailing various types of models such as context, interaction, structural, and behavioral models, primarily using Unified Modeling Language (UML). It explains the purpose of UML diagrams, including activity, class, sequence, and use case diagrams, and their role in visualizing system architecture and user interactions. Additionally, it discusses the importance of modeling for understanding system functionality and facilitating communication among stakeholders.

Uploaded by

ajmalumar085
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 74

Software Engineering

BS CS 3rd
SYSTEM MODELING

1 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Chapter 5 – System Modeling

Topics Covered:
• Context models
• Interaction models
• Structural models
• Behavioral models
• Model-driven engineering
2 Hassan Raza Jaffri (MS-Information Security) 12/3/2024
UML
 Unified Modeling Language (UML)
Unified Modeling Language is a graphical visualization language. It consists of a series of symbols
and connectors that can be used to create process diagrams and is often used to model computer
programs and workflows.
The UML standard defines nine types of diagram:
 Activity: model the flow of a system from action to response.
 Class: define the structure of a system.
 Collaboration: represents interaction between objects as a series of messages.
 ( collaboration diagram is a type of visual presentation that shows how various software objects interact
with each other within an overall architecture and how users can benefit from this collaboration.)
 Component: describe the organization of software components.
 Deployment: depict the physical resources of a system. (Deployment diagrams are used by the
system engineers, Deployment diagrams consist of nodes and their relationships. Deployment diagrams are
used to visualize the topology of the physical components of a system, where the software components are
deployed.)
 The purpose of deployment diagrams can be described as −
 Visualize the hardware topology of a system.
 Describe the hardware components used to deploy software components.
 Describe the runtime processing nodes.

3 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


UML Diagrams
 Object: describe the static structure of a system at a particular time. (An object
diagram is a graph of instances, including objects and data values. object diagram focuses on some
particular set of objects and attributes, and the links between these instances.)
 Package: method of organizing the elements of a system into related groups.
(Package diagrams are used to structure high level system elements. Packages are used for
organizing large system which contains diagrams, documents and other key deliverables,
Package Diagram can be used to simplify complex class diagrams, it can group classes into
packages) A State chart diagram describes a state machine. State machine can be defined as a
machine which defines different states of an object and these states are controlled by
external or internal events. Activity diagram is a special kind of a State chart diagram.
 Use Case: models the functionality of a system in terms of user interaction.
 Sequence: describes the interaction between classes in terms of message
exchange.
 State chart: describe the dynamic behavior of a system in response to external
Events. (It describes different states of a component/Objects in a system).
 Although primarily created to support software development, UML diagrams
can be used to visualize website structure and user interaction.

4 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


System modeling
 System modeling is the process of developing abstract models
of a system, with each model presenting a different view or
perspective of that system…
 System modeling has now come to mean representing a
system using some kind of graphical notation, which is now
almost always based on notations in the Unified Modeling
Language (UML)…
 System modelling helps the analyst to understand the
functionality of the system and models are used to
communicate with customers…

5 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Existing and Planned system models:
 Models of the existing system are used during requirements
engineering. They help clarify what the existing system does and
can be used as a basis for discussing its strengths and weaknesses.
These then lead to requirements for the new system.
 Models of the new system are used during requirements
engineering to help explain the proposed requirements to other
system stakeholders. Engineers use these models to discuss
design proposals and to document the system for
implementation.

6 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


System perspectives
 An external perspective, where you model the context or
environment of the system.
 An interaction perspective, where you model the interactions
between a system and its environment, or between the
components of a system.
 A structural perspective, where you model the organization of a
system or the structure of the data that is processed by the
system.
 A behavioral perspective, where you model the dynamic
behavior of the system and how it responds to events.

7 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Process Model:
 Process models show the overall process and the processes
that are supported by the system.
 Data flow models may be used to show the processes and the
flow show the processes and the flow of information from
one process to another. information from one process to
another.

8 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


UML diagram types
 Activity diagrams, which show the activities involved in a
process or in data processing…
 Use case diagrams, which show the interactions between a
system and its environment.
 Sequence diagrams, which show interactions between actors
and the system and between system components.
 Class diagrams, which show the object classes in the system
and the associations between these classes.
 State diagrams, which show how the system reacts to internal
and external events.

9 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Use of graphical models
 As a means of facilitating discussion about an existing or
proposed system
 As a way of documenting an existing system
 As a detailed system description that can be used to generate
a system implementation.

10 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Context models:
 What is the system and what is the system’s environment.
 Context models are used to demonstrate the operational context of a
system - they show what lies outside the system boundaries.
 Social and organisational concerns may affect the decision on where to
position system boundaries.
 Architectural models show the system and its relationship with other
systems.

11 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


System boundaries
 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 deep effect on the
system requirements.

12 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


The context of the MHC-PMS

13 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


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.
 UML activity diagrams may be used to define business process
models.

14 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Interaction models
 Modeling user interaction is important as it helps to identify
user requirements.
 Modeling system-to-system interaction highlights the
communication problems that may arise.
 Modeling component interaction helps us understand if a
proposed system structure is likely to deliver the required
system performance and dependability.
 Use case diagrams and sequence diagrams may be used for
interaction modelling.

15 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Use case modeling
 Use cases were developed originally to support requirements
elicitation and now incorporated into the UML.
 Each use case represents a distinct task that involves external
interaction with a system.
 Actors in a use case may be people or other systems.
 Represented diagrammatically to provide an overview of the
use case and in a more detailed textual form.

16 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Transfer-data use case
 A use case in the MHC-PMS

17 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Tabular description of the ‘Transfer
data’ use-case
MHC-PMS: Transfer data
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
Comments The receptionist must have appropriate security
permissions to access the patient information and the
PRS.

18 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Use cases in the MHC-PMS involving
the role ‘Medical Receptionist’

19 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


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.
 A sequence diagram shows the sequence of interactions that
take place during a particular use case or use case instance.
 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 arrows.

20 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Sequence Diagram
 Sequence diagram: an “interaction diagram” that models a
single scenario executing in a system
 • 2nd most used UML diagram (behind class diagram)
 • Shows what messages are sent and when

21 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Key parts of a sequence diagram
 Participant: an object or an entity; the sequence diagram
actor
• sequence diagram starts with an unattached "found
message" arrow
• Message: communication between objects
• Axes in a sequence diagram:
• horizontal: which participant is acting
• vertical: time (↓ forward in time)

22 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Key parts of a sequence diagram
 An object: a box with an underlined label that specifies the
object type, and optionally the object name.
• Write the object's name if it clarifies the diagram.
 An object's "life line" is represented by a dashed vertical line.
• Represents the life duration of the object during the scenario
being modeled
A message (method call): horizontal arrow to the receiving
object.
• Write message name and arguments above the arrow.

23 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Representing objects
 An object: a box with an underlined label that specifies the
object type, and optionally the object name.
• Write the object's name if it clarifies the diagram.
An object's "life line" is represented by a dashed vertical line.

24 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Different types of messages
 Type of arrow indicates types of messages:
• Synchronous message: solid arrow with a solid head.
• Asynchronous message: solid arrow with a stick head.
• Return message: dashed arrow with stick head.

25 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Indicating method execution
Activation: thick box over object's life line, drawn when an
object's method is on the stack
• Either that object is running its code, or it is on the stack
waiting for another object's method to finish

26 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Lifetime of objects
 Object creation: an arrow with new written above it
 • An object created after the start of the scenario appears
lower than the others.
• Object deletion: X at the bottom of object's lifeline

27 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Example Sequence diagram:

28 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Why use sequence diagrams
 A good sequence diagram is still above the level of the real
code
 • Sequence diagrams are language-agnostic (can be
implemented in many different languages)
• Non-coders can read and write sequence diagrams.
• Easier to do sequence diagrams as a team.
• Can see many objects/classes at a time on same page

29 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Online bookstore example
1. The customer begins the interaction by searching for a
book by title.
2. The system will return all books with that title.
3. The customer can look at the book description.
4. The customer can place a book in the shopping cart.
5. The customer can repeat the interaction as many times as
desired.
6. The customer can purchase the items in the cart by
checking out.

30 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Online bookstore sequence diagram

31 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Key parts of a sequence diagram

32 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Sequence diagram for View patient
information

33 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Sequence diagram for Transfer Data

34 12/3/2024
Hassan Raza Jaffri (MS-Information Security)
Structural models
 Structural models of software display the organization of a
system in terms of the components that make up that system
and their relationships.
 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.

35 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class diagrams:
 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…!

36 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class diagrams
When it comes to system construction, a class
diagram is the most widely used diagram.
This diagram generally consists
of interfaces, classes, associations. Such a
diagram would illustrate the object-oriented
view of a system, which is static in nature.

37 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class Diagram

38 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Multiplicity Example

39 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Relationships between classes
generalization: an inheritance relationship
– inheritance between classes
– interface implementation
association: a usage relationship
– dependency
– aggregation
– composition

40 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Association types
aggregation: “is part of ” – symbolized by a clear white
diamond.
composition: “is entirely made of ” – stronger version of
aggregation – the parts live and die with the whole –
symbolized by a black diamond.

41 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Generalization
 A generalization describes a relationship between a general
kind of thing and a more specific kind of thing. This type of
relationship is often described as an “is a” relationship. For
example, a car is a vehicle and a truck is a vehicle. In this case,
vehicle is the general thing, whereas car and truck are the
more specific things. Generalization relationships are used for
modeling class inheritance and specialization. A general class
is sometimes called a superclass, base class, or parent class; a
specialized class is called a subclass, derived class, or child
class.

42 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Inheritance
 Several classes may have the same attributes and/or methods.
When this occurs, a general class is created containing the
common attributes and methods. The specialized class inherits or
receives the attributes and methods of the general class. In
addition, the specialized class has attributes and methods that are
unique and only defined in the specialized class. Creating
generalized classes and allowing the specialized class to inherit
the attributes and methods helps to foster reuse, because the
code is used many times. It also helps to maintain existing
program code. This allows the analyst to define attributes and
methods once but use them many times, in each inherited class.

43 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Example Question
 A company consists of departments. Departments are
located in one or more offices. One office acts as a
headquarter. Each department has a manager who
is recruited from the set of employees.Your task is to model
the system for the company.
 Task:
 Draw a class diagram which consists of all the classes in your
system their attributes and operations, relationships between
the classes, multiplicity specifications, and other model
elements that you find appropriate

44 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


45 Hassan Raza Jaffri (MS-Information Security) 12/3/2024
Aggregation vs Composition
 Aggregation and Composition are subsets of association meaning they are specific
cases of association. In both aggregation and composition object of one class "owns"
object of another class. But there is a subtle difference.
 Aggregation implies a relationship where the child can exist independently of the
parent.
 Example: Class (parent) and Student (child). Delete the Class and the Students still
exist.
 Composition implies a relationship where the child cannot exist independent of the
parent.
 Example: House (parent) and Room (child). Rooms don't exist separate to a House.

46 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Composition Example:
 We should be more specific and use the composition link in
cases where in addition to the part-of relationship between
Class A and Class B - there's a strong lifecycle dependency
between the two, meaning that when Class A is deleted then
Class B is also deleted as a result.

47 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Aggregation Example
 It's important to note that the aggregation link doesn't state
in any way that Class A owns Class B nor that there's a
parent-child relationship (when parent deleted all its child's
are being deleted as a result) between the two.

48 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Generalization vs specialization
 Generalization is a mechanism for combining similar classes
of objects into a single, more general class. Generalization
identifies commonalities among a set of entities. The
commonality may be of attributes, behavior, or both. In other
words, a superclass has the most general attributes,
operations, and relationships that may be shared with
subclasses. A subclass may have more specialized attributes
and operations.

49 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Generalization vs specialization
 Specialization is the reverse process of Generalization means
creating new sub classes from an existing class.
 For Example, a Bank Account is of two types - Savings
Account and Credit Card Account. Savings Account and
Credit Card Account inherit the common/ generalized
properties like Account Number, Account Balance etc. from a
Bank Account and also have their own specialized properties
like unsettled payment etc.

50 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Generalization vs specialization

51 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class diagrams
Classes
 Classes represent an abstraction of entities with common characteristics.
Associations represent the relationships between classes.
 Illustrate classes with rectangles divided into compartments. Place the name of
the class in the first partition (centered, bolded, and capitalized), list the
attributes in the second partition (left-aligned, not bolded, and lowercase), and
write operations into the third.

52 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class diagrams
 Active Classes
 Active classes initiate and control the flow of activity, while
passive classes store data and serve other classes. Illustrate
active classes with a thicker border.

53 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class diagrams
 Visibility
 Use visibility markers to indicate who can access the information contained
within a class. Private visibility, denoted with a - sign, hides information from
anything outside the class partition. Public visibility, denoted with a + sign,
allows all other classes to view the marked information. Protected visibility,
denoted with a # sign, allows child classes to access information they inherited
from a parent class.

54 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class diagrams
 Associations
 Associations represent static relationships between classes.
Place association names above, on, or below the association
line. Use a filled arrow to indicate the direction of the
relationship. Place roles near the end of an association. Roles
represent the way the two classes see each other.

55 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Class diagrams
 Multiplicity (Cardinality)
 Place multiplicity notations near the ends of an association.
These symbols indicate the number of instances of one class
linked to one instance of the other class. For example, one
company will have one or more employees, but each
employee works for just one company.

56 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Composition and Aggregation
 Composition is a special type of aggregation that denotes a strong ownership
between Class A, the whole, and Class B, its part. Illustrate composition with a filled
diamond. Use a hollow diamond to represent a simple aggregation relationship, in
which the "whole" class plays a more important role than the "part" class, but the
two classes are not dependent on each other. The diamond ends in both composition
and aggregation relationships point toward the "whole" class (i.e., the aggregation).

57 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Composition and Aggregation
 In composition life of child completely control by the
parents.
 Aggregation represents the ownership whole/part
relationship.
 In composition the one object is part of other objects and in
aggregation the one object use other objects.
 Employee belongs to multiple department. If department is
delete the employee object would not be destroy.
 In composition if the parent destroy then the child also
destroyed.

58 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Generalization
 Generalization is another name for inheritance or an "is a"
relationship. It refers to a relationship between two classes
where one class is a specialized version of another. For
example, Honda is a type of car. So the class Honda would
have a generalization relationship with the class car.

59 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


 In real life coding examples, the difference between
inheritance and aggregation can be confusing. If you have an
aggregation relationship, the aggregate
 (the whole) can access only the PUBLIC functions of the
part class. On the other hand, inheritance allows the
inheriting class to access both the PUBLIC and PROTECTED
functions of the superclass.

60 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


UML classes and association

61 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Classes and associations in the MHC-
PMS

62 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


The Consultation class

63 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


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 entities in more general
classes (animals, cars, houses, etc.) and learn the
characteristics of these classes.
 This allows us to infer that different members of these classes
have some common characteristics e.g. squirrels and rats are
rodents.

64 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


A generalization hierarchy

65 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


A generalization hierarchy with added
detail

66 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


The aggregation association

67 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


68 Hassan Raza Jaffri (MS-Information Security) 12/3/2024
Behavioral models
 Behavioral models are models of the dynamic behavior of a
system as it is executing. They show what happens or what is
supposed to happen when a system responds from its
environment.
 You can think of these motives as being of two types:
 Data Some data arrives that has to be processed by the system.
 Events Some event happens that causes system processing.
Events may have associated data, although this is not always the
case.

69 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Activity Diagram:
 Activity diagrams show the flow of control between activities
–They can model the sequential and concurrent steps in a
computational process –They can also model the flow of an
object as it moves from state tot state at different points in
the activity.
 Activity diagram
• Shows flow of messages, logic, actions • This is at a much
higher level of abstraction than flow charts – Flow charts show
logic for single method (if statements, loops, etc.) – Activity
diagrams show flow among objects

70 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Activity Model:

71 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Activity Diagram:
 Activity diagram exercise
 • Draw an activity diagram for getting an apartment.
Example activities are: –
 Find roommates – Find apartment – Sign apartment rent –
Get electric service – Get phone or cable TV service – Get
gas or oil heat account set up – Obtain furniture – Move in
 • (Use this as a simple model of setting up a warehouse…)
 • Use activities, decision nodes, fork/join nodes

72 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


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.
 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 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 organization and architecture of a
system. Class diagrams are used to define the static structure of
classes in a system and their associations.

73 Hassan Raza Jaffri (MS-Information Security) 12/3/2024


Key Points:
 Behavioral models are used to describe the dynamic behavior of an
executing system. This behavior can be modeled from the perspective of
the data processed by the system, or by the events that stimulate
responses from a system.
 Activity diagrams may be used to model the processing of data, where
each activity represents one process step.
 State diagrams are used to model a system’s behavior in response to
internal or external events.
 Model-driven engineering is an approach to software development in
which a system is represented as a set of models that can be
automatically transformed to executable code.

74 Hassan Raza Jaffri (MS-Information Security) 12/3/2024

You might also like