SlideShare a Scribd company logo
Activity Diagrams and State Charts
for detailed modeling
Larman, chapters 28 and 29
CSE 432: Object-Oriented Software Engineering
Glenn D. Blank
Goals of OO design
ïź OO design develops the analysis into a blueprint of a solution
 Where does the “blueprint” metaphor come from?
ïź OO design starts by fleshing the class diagrams
 Coad & Nicola call this "the continuum of representation principle:
use a single underlying representation, from problem domain to
OOA to OOD to OOP," i.e., class diagrams
 Reworks and adds detail to class diagrams, e.g., attribute types,
visibility (public/private), additional constraints
 Looks for opportunities for reuse
 Addresses performance issues, both for system and users
 Designs UI, database, networking, as needed
 Designs ADT to describe the semantics of classes in more detail
 Develops unit test plans based on class diagrams and ADT design
Activity Diagram - Figure 28.1
Receive Video
Order
Fill Order Send Invoice
Deliver
Order
Receive Payment
Close Order
Fulfillment Customer
Service
Finance
Order
Invoice
start
Action. It does something.
There is an automatic
transition on its completion.
A transition supports
modeling of control flow.
Fork. One incoming
transition, and multiple
outgoing parallel transitions
and/or object flows.
Partitions. Show different
parties involved in the process
Join. Multiple incoming transitions and/or
object flows; one outgoing transition.
The outgoing continuation does not happen
until all the inputs arrive from all flows.
Object Node. An object
produced or used by actions.
This allows us to model data
flows or object flows.
end of activity
‱ Petri nets notation
‱ What are actions? Transitions?
‱ How does it support parallelism?
When to create Activity diagrams?
ïź Modeling simple processes or complex ones?
ïź Modeling business processes
 Helps visualize multiple parties and parallel actions
ïź Modeling data flow (alternative to DVD notation)
 Visualize major steps & data in software processes
1
Check Course
Availability
Courses
2
Check Applicant
Qualification
Applications Students
Applicant application
course data
application
application
student data
accept/deny reply
external actor
data store, such as a
DB, DB table, or file
data flow
process
DFD for Automated Course Registration System
Activity diagram to
show data flow model
Notation pros & cons?
Student Registration
System
Application
Complete
Application
Check Course
Availability
«datastore»
Courses
«datastore»
Applications
Check Applicant
Qualification
«datastore»
Students
Accept/Deny
Reply
1
Check Course
Availability
Courses
2
Check Applicant
Qualification
Applications Students
Applicant application
course data
application
application
student data
accept/deny reply
external actor
data store, such as a
DB, DB table, or file
data flow
process
DFD for Automated Course Registration System
Figure 28.3
Figure 28.2
What does the Rake
symbol mean?
When to use it?
Receive Video
Order
Fill Order Send Invoice
Deliver
Order
Receive Payment
Close Order
Accept a signal
Resend Invoice
Cancel
request
Cancel Order
30 days since sent last invoice,
and no payment received
A time signal
Fig. 28.5
Deliver Regular Deliver Rush
[ rush ]
[ else ]
Deliver Order
Decision: Any
branch happens.
Mutual exclusion
Merge: Any input leads
to continuation. This is
in contrast to a join, in
which case all the
inputs have to arrive
before it continues.
Figure 28.6
State chart Diagrams
initial State
state
transition
event
A State chart diagram shows the lifecycle of an object
‱ A state is a condition of an object for a particular time
‱ An event causes a transition from one state to another state
‱ Here is a State chart for a Phone Line object:
State charts in UML:
States in ovals, Transitions as arrows
ïź Transitions labels have three
optional parts:
Event [Guard] / Action
 Find one of each
 Item Received is an event,
/get first item is an action,
[Not all items checked] is a
guard
ïź State may also label activities,
e.g., do/check item
 Actions, associated with
transitions, occur quickly
and aren’t interruptible
 Activities, associated with
states, can take longer and
are interruptible
 Definition of “quickly” depends
on the kind of system,
e.g., real-time vs. info system
When to develop a state chart?
Model objects that have change state in
interesting ways:
ïź Devices (microwave oven, Ipod)
ïź Complex user interfaces (e.g., menus)
ïź Transactions (databases, banks, etc.)
ïź Stateful sessions (server-side objects)
ïź Controllers for other objects
ïź Role mutators (what role is an object playing?)
ïź Etc.
Case Study: Full Screen Entry Systems
‑
ïź Straightforward data processing application:
menu driven data entry (see overhead)
‑
 Each menu comes with a panel of information & lets user
choose next action
 Interaction during a airline reservation session
 Enquiry on flights, information & possible new states
ïź Meyer shows different ways to solve problem
 goto flow (50's),
 functional decomposition (70's)
 OO design (90's): improves reusability and extensibility
Superstates (nested states)
ïź Example shows a
super-state of
three states
ïź Can draw a
single transition
to and from a
super-state
ïź How does this
notation make
things a bit
clearer?
Concurrency in state diagrams
 Dashed line indicates that an order is in two different
states, e.g. Checking & Authorizing
 When order leaves concurrent states, it’s in a single
state: Canceled, Delivered or Rejected
Classes as active state machines
ïź Consider whether a class should keep track of its own internal state
 Example from Bertrand Meyer: first cut design of LINKED_LIST class
class LINKABLE[T] linkable cells
‑‑
feature
value:T;
right: LINKABLE[T]; next cell
‑‑
‑‑routines to change_value, change_right
end;
class LINKEDLIST[T]
feature
nb_elements: INTEGER;
first_element: LINKABLE[T];
value(i:INTEGER):T is value of i th element; loop until it reaches the ith element
‑‑ ‑
insert(i:INTEGER; val:T); loop until it reaches ith element, then insert val
‑‑
delete(i:INTEGER); loop until it reaches ith element, then delete it
‑‑
ïź Problems with first cut?
‑
ïź Getting the loops right is tricky (loops are error prone)
‑
ïź Redundancy: the same loop logic recurs in all these routines
 Reuse leads to inefficiency: suppose I want a routine search
 Find an element then replace it: I'll do the loop twice!
 Need some way to keep track of the position I found!
 Could return the LINKABLE cell found, but this would ruin encapsulation
Classes as active state machines (cont.)
ïź Instead, view LINKED_LIST as a machine with an internal state
 Internal state is information stored as attributes of an object
ïź What have we added to represent internal state?
 Cursor: current position in the list
 search(item) routine moves the cursor until it finds item
 insert and delete operate on the element pointed at by cursor
 How does this simplify the code of insert, delete, etc.?
 Client has a new view of LINKED_LIST objects:
 l.search(item); find item in l
‑‑
 if not offright then delete end; delete LINKABLE at cursor
‑‑
 Other routines move cursor: l.back; l.forth
Key idea for OOD: data structures can be active
 Active structures have internal states, which change
 Routines manipulate the object's state
ïź What other classes could be designed this way?
 Files, random number generators, tokenizers, ...
 Class as state machine view may not be obvious
during analysis
 A good reason for redesign!

More Related Content

PDF
CS8592 Object Oriented Analysis & Design - UNIT I
PPTX
06_Model Behaviour materiiiiiiiiiiii.pptx
PPT
Ch08
PDF
Online eaxmination
PPTX
Modeling- Object, Dynamic and Functional
PPT
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
PPT
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
CS8592 Object Oriented Analysis & Design - UNIT I
06_Model Behaviour materiiiiiiiiiiii.pptx
Ch08
Online eaxmination
Modeling- Object, Dynamic and Functional
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt

Similar to Activity Diagram Berbasis Object Oriented (20)

PPT
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
DOCX
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docx
PPTX
Crafted Design - LJC World Tour Mash Up 2014
PPTX
object oriented methodologies
PPT
New phase ii-2010
 
PDF
Free ebooks download ! Edhole
PDF
Free ebooks download ! Edhole
PPT
Analysis modeling in software engineering
ODP
BIS09 Application Development - III
PPT
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
PPT
Analysis modeling
PPT
Modeling System Requirements
PDF
FME World Tour 2015 - FME & Data Migration Simon McCabe
 
PDF
CS8592 Object Oriented Analysis & Design - UNIT V
PPT
System Analysis and Design in a changing world 5th edition
PPT
Introducing Uml And Development Process
PPTX
Crafted Design - GeeCON 2014
PPT
SECh1214
PPTX
OOAD unit1 introduction to object orientation
PPTX
Final
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docx
Crafted Design - LJC World Tour Mash Up 2014
object oriented methodologies
New phase ii-2010
 
Free ebooks download ! Edhole
Free ebooks download ! Edhole
Analysis modeling in software engineering
BIS09 Application Development - III
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
Analysis modeling
Modeling System Requirements
FME World Tour 2015 - FME & Data Migration Simon McCabe
 
CS8592 Object Oriented Analysis & Design - UNIT V
System Analysis and Design in a changing world 5th edition
Introducing Uml And Development Process
Crafted Design - GeeCON 2014
SECh1214
OOAD unit1 introduction to object orientation
Final
Ad

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
ai tools demonstartion for schools and inter college
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
medical staffing services at VALiNTRY
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Digital Strategies for Manufacturing Companies
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Introduction to Artificial Intelligence
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
AI in Product Development-omnex systems
PDF
Softaken Excel to vCard Converter Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PTS Company Brochure 2025 (1).pdf.......
wealthsignaloriginal-com-DS-text-... (1).pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
ai tools demonstartion for schools and inter college
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
medical staffing services at VALiNTRY
VVF-Customer-Presentation2025-Ver1.9.pptx
Digital Strategies for Manufacturing Companies
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Introduction to Artificial Intelligence
Upgrade and Innovation Strategies for SAP ERP Customers
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Odoo POS Development Services by CandidRoot Solutions
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
AI in Product Development-omnex systems
Softaken Excel to vCard Converter Software.pdf
Ad

Activity Diagram Berbasis Object Oriented

  • 1. Activity Diagrams and State Charts for detailed modeling Larman, chapters 28 and 29 CSE 432: Object-Oriented Software Engineering Glenn D. Blank
  • 2. Goals of OO design ïź OO design develops the analysis into a blueprint of a solution  Where does the “blueprint” metaphor come from? ïź OO design starts by fleshing the class diagrams  Coad & Nicola call this "the continuum of representation principle: use a single underlying representation, from problem domain to OOA to OOD to OOP," i.e., class diagrams  Reworks and adds detail to class diagrams, e.g., attribute types, visibility (public/private), additional constraints  Looks for opportunities for reuse  Addresses performance issues, both for system and users  Designs UI, database, networking, as needed  Designs ADT to describe the semantics of classes in more detail  Develops unit test plans based on class diagrams and ADT design
  • 3. Activity Diagram - Figure 28.1 Receive Video Order Fill Order Send Invoice Deliver Order Receive Payment Close Order Fulfillment Customer Service Finance Order Invoice start Action. It does something. There is an automatic transition on its completion. A transition supports modeling of control flow. Fork. One incoming transition, and multiple outgoing parallel transitions and/or object flows. Partitions. Show different parties involved in the process Join. Multiple incoming transitions and/or object flows; one outgoing transition. The outgoing continuation does not happen until all the inputs arrive from all flows. Object Node. An object produced or used by actions. This allows us to model data flows or object flows. end of activity ‱ Petri nets notation ‱ What are actions? Transitions? ‱ How does it support parallelism?
  • 4. When to create Activity diagrams? ïź Modeling simple processes or complex ones? ïź Modeling business processes  Helps visualize multiple parties and parallel actions ïź Modeling data flow (alternative to DVD notation)  Visualize major steps & data in software processes 1 Check Course Availability Courses 2 Check Applicant Qualification Applications Students Applicant application course data application application student data accept/deny reply external actor data store, such as a DB, DB table, or file data flow process DFD for Automated Course Registration System
  • 5. Activity diagram to show data flow model Notation pros & cons? Student Registration System Application Complete Application Check Course Availability «datastore» Courses «datastore» Applications Check Applicant Qualification «datastore» Students Accept/Deny Reply 1 Check Course Availability Courses 2 Check Applicant Qualification Applications Students Applicant application course data application application student data accept/deny reply external actor data store, such as a DB, DB table, or file data flow process DFD for Automated Course Registration System Figure 28.3 Figure 28.2
  • 6. What does the Rake symbol mean? When to use it? Receive Video Order Fill Order Send Invoice Deliver Order Receive Payment Close Order Accept a signal Resend Invoice Cancel request Cancel Order 30 days since sent last invoice, and no payment received A time signal Fig. 28.5 Deliver Regular Deliver Rush [ rush ] [ else ] Deliver Order Decision: Any branch happens. Mutual exclusion Merge: Any input leads to continuation. This is in contrast to a join, in which case all the inputs have to arrive before it continues. Figure 28.6
  • 7. State chart Diagrams initial State state transition event A State chart diagram shows the lifecycle of an object ‱ A state is a condition of an object for a particular time ‱ An event causes a transition from one state to another state ‱ Here is a State chart for a Phone Line object:
  • 8. State charts in UML: States in ovals, Transitions as arrows ïź Transitions labels have three optional parts: Event [Guard] / Action  Find one of each  Item Received is an event, /get first item is an action, [Not all items checked] is a guard ïź State may also label activities, e.g., do/check item  Actions, associated with transitions, occur quickly and aren’t interruptible  Activities, associated with states, can take longer and are interruptible  Definition of “quickly” depends on the kind of system, e.g., real-time vs. info system
  • 9. When to develop a state chart? Model objects that have change state in interesting ways: ïź Devices (microwave oven, Ipod) ïź Complex user interfaces (e.g., menus) ïź Transactions (databases, banks, etc.) ïź Stateful sessions (server-side objects) ïź Controllers for other objects ïź Role mutators (what role is an object playing?) ïź Etc.
  • 10. Case Study: Full Screen Entry Systems ‑ ïź Straightforward data processing application: menu driven data entry (see overhead) ‑  Each menu comes with a panel of information & lets user choose next action  Interaction during a airline reservation session  Enquiry on flights, information & possible new states ïź Meyer shows different ways to solve problem  goto flow (50's),  functional decomposition (70's)  OO design (90's): improves reusability and extensibility
  • 11. Superstates (nested states) ïź Example shows a super-state of three states ïź Can draw a single transition to and from a super-state ïź How does this notation make things a bit clearer?
  • 12. Concurrency in state diagrams  Dashed line indicates that an order is in two different states, e.g. Checking & Authorizing  When order leaves concurrent states, it’s in a single state: Canceled, Delivered or Rejected
  • 13. Classes as active state machines ïź Consider whether a class should keep track of its own internal state  Example from Bertrand Meyer: first cut design of LINKED_LIST class class LINKABLE[T] linkable cells ‑‑ feature value:T; right: LINKABLE[T]; next cell ‑‑ ‑‑routines to change_value, change_right end; class LINKEDLIST[T] feature nb_elements: INTEGER; first_element: LINKABLE[T]; value(i:INTEGER):T is value of i th element; loop until it reaches the ith element ‑‑ ‑ insert(i:INTEGER; val:T); loop until it reaches ith element, then insert val ‑‑ delete(i:INTEGER); loop until it reaches ith element, then delete it ‑‑ ïź Problems with first cut? ‑ ïź Getting the loops right is tricky (loops are error prone) ‑ ïź Redundancy: the same loop logic recurs in all these routines  Reuse leads to inefficiency: suppose I want a routine search  Find an element then replace it: I'll do the loop twice!  Need some way to keep track of the position I found!  Could return the LINKABLE cell found, but this would ruin encapsulation
  • 14. Classes as active state machines (cont.) ïź Instead, view LINKED_LIST as a machine with an internal state  Internal state is information stored as attributes of an object ïź What have we added to represent internal state?  Cursor: current position in the list  search(item) routine moves the cursor until it finds item  insert and delete operate on the element pointed at by cursor  How does this simplify the code of insert, delete, etc.?  Client has a new view of LINKED_LIST objects:  l.search(item); find item in l ‑‑  if not offright then delete end; delete LINKABLE at cursor ‑‑  Other routines move cursor: l.back; l.forth
  • 15. Key idea for OOD: data structures can be active  Active structures have internal states, which change  Routines manipulate the object's state ïź What other classes could be designed this way?  Files, random number generators, tokenizers, ...  Class as state machine view may not be obvious during analysis  A good reason for redesign!