SlideShare a Scribd company logo
UML (Unified Modeling
Language)
2
Activity diagram
• Activity diagrams describe how activities are coordinated.
– For example, an activity diagram may be used (like an
interaction diagram) to show how an operation could
be implemented
• An activity diagram is particularly useful
– when you know that an operation has to achieve a
number of different things, and
3
Activity diagram
– you want to model what the essential dependencies
between them are, before you decide in what order to
do them
• Activity diagrams are much better at showing this clearly
than interaction diagrams.
– Activity diagrams model the workflow of a business
process and the sequence of activities in a process.
4
Activity diagrams
– These diagrams are very similar to a flowchart because
you can model a workflow from activity to activity or
from activity to state.
– It is often beneficial to create an activity diagram early
in the modeling of a process to help you understand the
overall process.
– Activity diagrams are also useful when you want to
describe parallel behavior or illustrate how behaviors in
several use cases interact.
5
Activity Diagram
6
7
Fork and Join Nodes
• Forks and joins have the same notation: either a horizontal
or vertical bar (the orientation is dependent on whether the
control flow is running left to right or top to bottom).
• They indicate the start and end of concurrent threads of
control.
• The following diagram shows an example of their use.
8
Fork and Join Nodes (cont)
• A join is different from a merge in that the join
synchronizes two inflows and produces a single outflow.
• The outflow from a join cannot execute until all inflows
have been received.
• A merge passes any control flows straight through it.
• If two or more inflows are received by a merge symbol,
the action pointed to by its outflow is executed two or
more times.
9
• At the UML semantics level, activity diagrams are state
diagrams extended for convenience with some extra
notation
• Elements of activity diagrams
– Activity
– Transition
– Synchronization bar
– Decision diamond
– Start and stop markers
10
Swim Lanes
• There is one other big notational element to activity
diagrams, Swim Lanes.
• Swim Lanes are used to illustrate which portions of a
system are responsible for particular elements of your
diagram.
• Here's an example:
• This diagram illustrates a User and a Website. The user is
attempting to log on to the website. As you can see, the
User is responsible for providing login credentials, while
the Website is responsible for authenticating the user.
11
Example of activity diagram with swim lanes:
12
Example
of swim
lanes
activity
diagram:
13
Business level activity diagram of the
library
14
Example:
15
Example:
16
State chart diagrams
– You can use state chart diagrams to model the dynamic
behavior of individual classes or objects.
– State chart diagrams show the sequences of states that
an object goes through, the events that cause a
transition from one state or activity to another, and the
actions that result from a state or activity change.
17
State chart diagrams
– A state chart diagram is typically used to model the
discrete stages of an object’s lifetime, whereas an
activity diagram is better suited to model the sequence
of activities in a process.
– It shows how behavior of an object changes across
several use case execution.
18
State Chart
19
State Diagrams
• Let us start with a very simple example
• in which an object receives a message and what it
does depends on the values of its attributes and
links.
• In our library system an object of class Copy may
have a Boolean attribute onShelf
• which is intended to record whether the object
describes a copy of a book
– which is currently in the library,
– or one which is currently on loan.
• The interface of a class Copy specifies that the
object should be willing to accept the message
borrow().
20
State diagram of class Copy
• The value of the copy’s attribute onShelf is important for
understanding the behaviour of the object,
– at level of what messages it sends after receiving message
itself
• We can name two significantly different states of a Copy object
– “on the shelf” and “on loan”
• We can record the messages that cause it to move between the
states as the events that cause transition between states.
21
Unexpected messages
• In previous figure we have not shown arrows to represent
– the receipt of message borrow() in state “on loan” or
– the message return() in state “on shelf”
• Under normal circumstances, such messages should not
arrive: if they do it’s a bug.
• So the code of class Copy will have to do something if these
“wrong” messages do arrive
In fact our convention is a departure from UML, which
specifies that an event, such as the arrival of message, that
does not trigger a transition is simply ignored
22
State, transitions, events
The most important elements of a state diagram, namely:
• States
– Shown as boxes with rounded corners
• Transitions between states
– Shown as arrows
• Events that cause transitions between states
– Shown by writing the message on the transition arrow
• Start marker
– Shown as a black blob with an (unlabeled) arrow into the
initial state of the diagram
• Stop marker
– Shown by a black blob with a ring round it
• and means that the object has reached the end of its life.
23
Actions
• The state diagrams were useful for understanding
how an object’s reaction to a message depends on
its state.
• An object sending a message in response to being
sent one itself
– is an example of an action being an object’s reaction to
an event.
• An event is something done to the object
• such as it being sent a message
• An action is something that the object does
• such as it sending a message
24
State diagram of class Copy with action
• Analysing the notation:
– The slash (/) shows that what follows is an action
– book followed by a dot identifies the object to which a
message is being sent
– returned(self) is an example of a message including a
parameter, where self is reference to itself
25
State diagram of class Copy with
- entry action
- exit action
• We can show our intention directly, by writing the
action inside the state, as a reaction to the special
event (e.g entry or exit)
26
Guards
• Sometimes the occurrence of the same event in the
same state may or may not cause a change of state,
– depending on the exact values of the object’s attributes
• We can show this using the same conditional
notation that is used in generic interaction
diagrams
Several actions in one diagram.
27
State diagram for class Book
• The borrowed() message cause a state change out
of state borrowable
– only if this is the last copy on the shelf;
– otherwise, the book object remains borrowable.
28
Example of state chart diagram:
29
Example of state chart diagram:
30
The main differences between activity diagrams
and state diagrams:
• Activity diagrams do not normally include events
• Activity is intended to proceed, following the flow
described by diagram, without getting stuck

More Related Content

Similar to 4 Activity & Statechart diagram.ppt4 Activity & Statechart diagram.ppt4 Activity & Statechart diagram.ppt (20)

PPT
Lecture#03, uml diagrams
babak danyal
 
PPT
Fundamentals of Software Engineering
Madhar Khan Pathan
 
PPT
Selab1 slides
Sumedha
 
PDF
SE_Lec 09_ UML Behaviour Diagrams
Amr E. Mohamed
 
PPT
Slide 6 Activity Diagram
Niloy Rocker
 
PPT
Uml Activity Diagram
Niloy Rocker
 
PPT
Jar chapter 4, part 1
Reham Maher El-Safarini
 
PDF
INTRODUCTION TO UML DIAGRAMS
Ashita Agrawal
 
DOC
Case Study Uml
ganesh12july
 
PDF
Free ebooks download ! Edhole
Edhole.com
 
PDF
Free ebooks download ! Edhole
Edhole.com
 
PPTX
UML
Jazib Amjad
 
PDF
Object-Oriented Analysis and Design report
ritikapoudel2017
 
PPTX
An introduction to uml
Tony Huynh
 
PPTX
Use case model
Ashwani Kumar
 
PPT
Activity Diagram Berbasis Object Oriented
Wiwin Banjarnahor
 
DOCX
Case tool lab-Reg2013 by Karthick Raja
ursKarthick Raja
 
PPTX
UML.pptx
RAJESH S
 
Lecture#03, uml diagrams
babak danyal
 
Fundamentals of Software Engineering
Madhar Khan Pathan
 
Selab1 slides
Sumedha
 
SE_Lec 09_ UML Behaviour Diagrams
Amr E. Mohamed
 
Slide 6 Activity Diagram
Niloy Rocker
 
Uml Activity Diagram
Niloy Rocker
 
Jar chapter 4, part 1
Reham Maher El-Safarini
 
INTRODUCTION TO UML DIAGRAMS
Ashita Agrawal
 
Case Study Uml
ganesh12july
 
Free ebooks download ! Edhole
Edhole.com
 
Free ebooks download ! Edhole
Edhole.com
 
Object-Oriented Analysis and Design report
ritikapoudel2017
 
An introduction to uml
Tony Huynh
 
Use case model
Ashwani Kumar
 
Activity Diagram Berbasis Object Oriented
Wiwin Banjarnahor
 
Case tool lab-Reg2013 by Karthick Raja
ursKarthick Raja
 
UML.pptx
RAJESH S
 

More from MuhammadAbubakar114879 (20)

PPT
Lecture 11.pptHuman Computer Interaction
MuhammadAbubakar114879
 
PPT
3 only package diagram till slide no. 13.ppt
MuhammadAbubakar114879
 
PPT
6 Design Pattern.ppt design pattern in softeare engineering
MuhammadAbubakar114879
 
PPTX
9 Component Based SE.pptx9 Component Based SE.pptx9 Component Based SE.pptx
MuhammadAbubakar114879
 
PPTX
8 SOA.pptx soa ppt in software engineering
MuhammadAbubakar114879
 
PPTX
7 SPL.pptx spl ppt in software engineering
MuhammadAbubakar114879
 
PPT
Lect_07_Use Case Diagram.ppt use case diagram
MuhammadAbubakar114879
 
PPTX
Lab4-Software-Construction-BSSE5.pptx ppt
MuhammadAbubakar114879
 
PPTX
Lecture3 - Methodologies - Software-Construction-BSSE5 (1).pptx
MuhammadAbubakar114879
 
PPTX
Lecture-7.pptx software design and Arthitechure
MuhammadAbubakar114879
 
PPTX
design_pattern.pptx design_pattern design_pattern
MuhammadAbubakar114879
 
PPTX
10- Architectureign Design_designnn.pptx
MuhammadAbubakar114879
 
PPTX
13- Architecture Evaluations_design.pptx
MuhammadAbubakar114879
 
PPTX
5-Oject Design & Mapping on Code__ .pptx
MuhammadAbubakar114879
 
PPTX
6-User Interface Design_6-User Interface Design.pptx
MuhammadAbubakar114879
 
PPTX
3-System Design_software_design_algo .pptx
MuhammadAbubakar114879
 
PPTX
Sequence_Diagram_software_Design_algo.pptx
MuhammadAbubakar114879
 
PPTX
lec 14-15 Jquery_All About J-query_.pptx
MuhammadAbubakar114879
 
PPTX
Natural_language_processingusing python.pptx
MuhammadAbubakar114879
 
PPTX
SPM presentation extra material-Lect 9and 10.pptx
MuhammadAbubakar114879
 
Lecture 11.pptHuman Computer Interaction
MuhammadAbubakar114879
 
3 only package diagram till slide no. 13.ppt
MuhammadAbubakar114879
 
6 Design Pattern.ppt design pattern in softeare engineering
MuhammadAbubakar114879
 
9 Component Based SE.pptx9 Component Based SE.pptx9 Component Based SE.pptx
MuhammadAbubakar114879
 
8 SOA.pptx soa ppt in software engineering
MuhammadAbubakar114879
 
7 SPL.pptx spl ppt in software engineering
MuhammadAbubakar114879
 
Lect_07_Use Case Diagram.ppt use case diagram
MuhammadAbubakar114879
 
Lab4-Software-Construction-BSSE5.pptx ppt
MuhammadAbubakar114879
 
Lecture3 - Methodologies - Software-Construction-BSSE5 (1).pptx
MuhammadAbubakar114879
 
Lecture-7.pptx software design and Arthitechure
MuhammadAbubakar114879
 
design_pattern.pptx design_pattern design_pattern
MuhammadAbubakar114879
 
10- Architectureign Design_designnn.pptx
MuhammadAbubakar114879
 
13- Architecture Evaluations_design.pptx
MuhammadAbubakar114879
 
5-Oject Design & Mapping on Code__ .pptx
MuhammadAbubakar114879
 
6-User Interface Design_6-User Interface Design.pptx
MuhammadAbubakar114879
 
3-System Design_software_design_algo .pptx
MuhammadAbubakar114879
 
Sequence_Diagram_software_Design_algo.pptx
MuhammadAbubakar114879
 
lec 14-15 Jquery_All About J-query_.pptx
MuhammadAbubakar114879
 
Natural_language_processingusing python.pptx
MuhammadAbubakar114879
 
SPM presentation extra material-Lect 9and 10.pptx
MuhammadAbubakar114879
 
Ad

Recently uploaded (20)

PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
PPTX
ENGlish 8 lesson presentation PowerPoint.pptx
marawehsvinetshe
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PPT
Indian Contract Act 1872, Business Law #MBA #BBA #BCOM
priyasinghy107
 
PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PPTX
Different types of inheritance in odoo 18
Celine George
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PPTX
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
PPTX
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PPTX
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
PDF
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
PPTX
How to Create & Manage Stages in Odoo 18 Helpdesk
Celine George
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
Navigating English Key Stage 2 lerning needs.pptx
JaysonClosa3
 
PPTX
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
PDF
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
PPTX
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
PPTX
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
ENGlish 8 lesson presentation PowerPoint.pptx
marawehsvinetshe
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
Indian Contract Act 1872, Business Law #MBA #BBA #BCOM
priyasinghy107
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
Different types of inheritance in odoo 18
Celine George
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
How to Create & Manage Stages in Odoo 18 Helpdesk
Celine George
 
Introduction to Indian Writing in English
Trushali Dodiya
 
Navigating English Key Stage 2 lerning needs.pptx
JaysonClosa3
 
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
Ad

4 Activity & Statechart diagram.ppt4 Activity & Statechart diagram.ppt4 Activity & Statechart diagram.ppt

  • 2. 2 Activity diagram • Activity diagrams describe how activities are coordinated. – For example, an activity diagram may be used (like an interaction diagram) to show how an operation could be implemented • An activity diagram is particularly useful – when you know that an operation has to achieve a number of different things, and
  • 3. 3 Activity diagram – you want to model what the essential dependencies between them are, before you decide in what order to do them • Activity diagrams are much better at showing this clearly than interaction diagrams. – Activity diagrams model the workflow of a business process and the sequence of activities in a process.
  • 4. 4 Activity diagrams – These diagrams are very similar to a flowchart because you can model a workflow from activity to activity or from activity to state. – It is often beneficial to create an activity diagram early in the modeling of a process to help you understand the overall process. – Activity diagrams are also useful when you want to describe parallel behavior or illustrate how behaviors in several use cases interact.
  • 6. 6
  • 7. 7 Fork and Join Nodes • Forks and joins have the same notation: either a horizontal or vertical bar (the orientation is dependent on whether the control flow is running left to right or top to bottom). • They indicate the start and end of concurrent threads of control. • The following diagram shows an example of their use.
  • 8. 8 Fork and Join Nodes (cont) • A join is different from a merge in that the join synchronizes two inflows and produces a single outflow. • The outflow from a join cannot execute until all inflows have been received. • A merge passes any control flows straight through it. • If two or more inflows are received by a merge symbol, the action pointed to by its outflow is executed two or more times.
  • 9. 9 • At the UML semantics level, activity diagrams are state diagrams extended for convenience with some extra notation • Elements of activity diagrams – Activity – Transition – Synchronization bar – Decision diamond – Start and stop markers
  • 10. 10 Swim Lanes • There is one other big notational element to activity diagrams, Swim Lanes. • Swim Lanes are used to illustrate which portions of a system are responsible for particular elements of your diagram. • Here's an example: • This diagram illustrates a User and a Website. The user is attempting to log on to the website. As you can see, the User is responsible for providing login credentials, while the Website is responsible for authenticating the user.
  • 11. 11 Example of activity diagram with swim lanes:
  • 13. 13 Business level activity diagram of the library
  • 16. 16 State chart diagrams – You can use state chart diagrams to model the dynamic behavior of individual classes or objects. – State chart diagrams show the sequences of states that an object goes through, the events that cause a transition from one state or activity to another, and the actions that result from a state or activity change.
  • 17. 17 State chart diagrams – A state chart diagram is typically used to model the discrete stages of an object’s lifetime, whereas an activity diagram is better suited to model the sequence of activities in a process. – It shows how behavior of an object changes across several use case execution.
  • 19. 19 State Diagrams • Let us start with a very simple example • in which an object receives a message and what it does depends on the values of its attributes and links. • In our library system an object of class Copy may have a Boolean attribute onShelf • which is intended to record whether the object describes a copy of a book – which is currently in the library, – or one which is currently on loan. • The interface of a class Copy specifies that the object should be willing to accept the message borrow().
  • 20. 20 State diagram of class Copy • The value of the copy’s attribute onShelf is important for understanding the behaviour of the object, – at level of what messages it sends after receiving message itself • We can name two significantly different states of a Copy object – “on the shelf” and “on loan” • We can record the messages that cause it to move between the states as the events that cause transition between states.
  • 21. 21 Unexpected messages • In previous figure we have not shown arrows to represent – the receipt of message borrow() in state “on loan” or – the message return() in state “on shelf” • Under normal circumstances, such messages should not arrive: if they do it’s a bug. • So the code of class Copy will have to do something if these “wrong” messages do arrive In fact our convention is a departure from UML, which specifies that an event, such as the arrival of message, that does not trigger a transition is simply ignored
  • 22. 22 State, transitions, events The most important elements of a state diagram, namely: • States – Shown as boxes with rounded corners • Transitions between states – Shown as arrows • Events that cause transitions between states – Shown by writing the message on the transition arrow • Start marker – Shown as a black blob with an (unlabeled) arrow into the initial state of the diagram • Stop marker – Shown by a black blob with a ring round it • and means that the object has reached the end of its life.
  • 23. 23 Actions • The state diagrams were useful for understanding how an object’s reaction to a message depends on its state. • An object sending a message in response to being sent one itself – is an example of an action being an object’s reaction to an event. • An event is something done to the object • such as it being sent a message • An action is something that the object does • such as it sending a message
  • 24. 24 State diagram of class Copy with action • Analysing the notation: – The slash (/) shows that what follows is an action – book followed by a dot identifies the object to which a message is being sent – returned(self) is an example of a message including a parameter, where self is reference to itself
  • 25. 25 State diagram of class Copy with - entry action - exit action • We can show our intention directly, by writing the action inside the state, as a reaction to the special event (e.g entry or exit)
  • 26. 26 Guards • Sometimes the occurrence of the same event in the same state may or may not cause a change of state, – depending on the exact values of the object’s attributes • We can show this using the same conditional notation that is used in generic interaction diagrams Several actions in one diagram.
  • 27. 27 State diagram for class Book • The borrowed() message cause a state change out of state borrowable – only if this is the last copy on the shelf; – otherwise, the book object remains borrowable.
  • 28. 28 Example of state chart diagram:
  • 29. 29 Example of state chart diagram:
  • 30. 30 The main differences between activity diagrams and state diagrams: • Activity diagrams do not normally include events • Activity is intended to proceed, following the flow described by diagram, without getting stuck