Activity Diagrams and State Charts for detailed modeling Larman, chapters 28 and 29 CSE 432: Object-Oriented Software Engineering Glenn D. Blank.

Slides:



Advertisements
Similar presentations
UML State Machine Diagrams and Modeling
Advertisements

State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Object-oriented design CSE 432: Object-Oriented Software Engineering.
Karolina Muszyńska Based on:
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Robert B. Jackson Brigham Young University John W. Satzinger
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 04. Other.
Introduction To System Analysis and Design
Systems Analysis and Design in a Changing World, Fourth Edition
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 System models.
CS 425/625 Software Engineering System Models
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models September 29, 2008.
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 71 System models l Abstract descriptions of systems whose requirements are being analysed.
Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
Detailed Object-Oriented Requirements Definitions
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
SE-565 Software System Requirements More UML Diagrams.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s.
Domain Modeling Chandan R. Rupakheti and Steve Chenoweth Week 5, Day 1.
Object-Oriented Analysis and Design
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
The Design Discipline.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
Chapter 7 Structuring System Process Requirements
Chapter 4 System Models A description of the various models that can be used to specify software systems.
System models Abstract descriptions of systems whose requirements are being analysed Abstract descriptions of systems whose requirements are being analysed.
An Introduction to Software Architecture
Software Engineering 1 Object-oriented Analysis and Design Chap 29 UML State Machine Diagrams and Modeling.
NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello.
The Object-Oriented Approach to Requirements
Introduction To System Analysis and Design
Behavioral diagrams Lecture p4 T120B pavasario sem.
1 UML Basic Training. UML Basic training2 Agenda  Definitions: requirements, design  Basics of Unified Modeling Language 1.4  SysML.
Chapter 7 System models.
System models l Abstract descriptions of systems whose requirements are being analysed.
Modified by Juan M. Gomez Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
Systems Analysis and Design in a Changing World, 3rd Edition
Software Engineering, 8th edition Chapter 8 1 Courtesy: ©Ian Somerville 2006 April 06 th, 2009 Lecture # 13 System models.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Introduction to UML: Unified Modeling Language Ric Holt U Waterloo, March 2009 CS246.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Chapter 9 Applying UML and Patterns -Craig Larman
7 Systems Analysis and Design in a Changing World, Fifth Edition.
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
What to remember from Chap 13 (Logical architecture)
CSCI-383 Object-Oriented Programming & Design Lecture 10.
7. 2Object-Oriented Analysis and Design with the Unified Process Objectives  Detailed Object-Oriented Requirements Definitions  System Processes—A Use.
Human Computer Interaction
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Systems Analysis and Design in a Changing World, Fourth Edition
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Topic 4 - Database Design Unit 1 – Database Analysis and Design Advanced Higher Information Systems St Kentigern’s Academy.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
CS223: Software Engineering
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 17 Object-Oriented Design and Modeling Using the UML.
7 Systems Analysis – ITEC 3155 The Object Oriented Approach – Use Cases.
Engineering, 7th edition. Chapter 8 Slide 1 System models.
GRASP – Designing Objects with Responsibilities
Introduction to UML: Unified Modeling Language
Analysis models and design models
Activity Diagrams and State Charts for detailed modeling
An Introduction to Software Architecture
CHAPTER 2 Object-Oriented Modeling Using UML (Continued)
Lecture 3 – Data collection List ADT
Presentation transcript:

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 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

Activity diagram to show data flow model Notation pros & cons? Figure 28.3 Figure 28.2

What does the Rake symbol mean? When to use it? Fig 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 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 Example Can draw a single transition to and from a super-state How does this notation make things a bit clearer?

ConcurrencyConcurrency 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!