Copyright 8 2002 Flying Kiwi Productions Inc. 1 An Introduction to Object-Oriented Analysis Objects and UML in plain English. Chapter.

Slides:



Advertisements
Similar presentations
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Advertisements

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
Use Case - Example University library system requirements
Lecture 5 …a bit more about UML Sequence diagrams Collaboration diagrams State-chart diagrams CRC cards.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Lecture 4 Class Responsibility Collaboration Cards
Essentials of interaction diagrams Lecture 23 & 24.
Essentials of state and activity diagram Lecture 24.
PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 © John Wiley & Sons, Inc. All rights reserved. Slide 1.
Modeling System Events Adapted from: Systems Analysis and Design in a Changing World, 2nd Edition by John W. Satzinger, Robert Jackson and Stephen Burd.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
7. 2Object-Oriented Analysis and Design with the Unified Process Objectives  Detailed Object-Oriented Requirements Definitions  System Processes—A Use.
Overview Objective: refine information gathered
2Object-Oriented Analysis and Design with the Unified Process Events and Use Cases  Use case  Activity the system carries out  Entry point into the.
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.
Copyright ©2014 Pearson Education, Inc. Chapter 3 Requirements and Business Rules Chapter3.1.
1 Copyright Flying Kiwi Productions Inc. An Introduction to Object-Oriented Analysis Objects and UML in plain English. Chapter.
Systems Analysis and Design in a Changing World, Fifth Edition
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
程建群 博士(Dr. Jason Cheng) 年03月
Introduction to Sequence Diagrams
1 CMPT 275 Phase: Design. Janice Regan, Map of design phase DESIGN HIGH LEVEL DESIGN Modularization User Interface Module Interfaces Data Persistance.
Lecture 03: Theory of Automata:08 Finite Automata.
1 Copyright Flying Kiwi Productions Inc. An Introduction to Object-Oriented Analysis Objects and UML in plain English. Chapter.
Systems Analysis and Design in a Changing World, Fifth Edition
Guide to State Transition Diagram. 2 Contents  What is state transition diagram?  When is state transition diagram used?  What are state transition.
Lecture 07: Formal Methods in SE Finite Automata Lecture # 07 Qaisar Javaid Assistant Professor.
Copyright 2002 Prentice-Hall, Inc. Chapter 2 Object-Oriented Analysis and Design Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 8: Behavioral Modeling.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Session 21 Applying the Basic Statechart to the Case Study Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 27, 2011 Presented by.
Session 22 Modeling the Extended Features of the Statechart Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 27, 2011 Presented.
CSIS3600 System Analysis and Design Statechart Diagrams.
Objectives Explain how events can be used to identify use cases that define requirements Identify and analyze events and resulting use cases Explain.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
9-1 © Prentice Hall, 2004 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
An Introduction to the Unified Modeling Language
5 Systems Analysis and Design in a Changing World, Fifth Edition.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 8: Behavioral Modeling.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 5 INTRODUCTION TO SYSTEMS ANALYSIS AND DESIGN: AN AGILE, ITERATIVE APPROACH CHAPTER.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
Scenario A scenario is a sequence of steps describing an interaction between a user and a system. Use case is a set of scenarios tied together by a common.
Systems Analysis and Design in a Changing World, Fourth Edition
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Chapter 3 Requirements and Business Rules Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter3.1.
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.
1 Copyright Flying Kiwi Productions Inc. An Introduction to Object-Oriented Analysis Objects and UML in plain English. Chapter.
Copyright Flying Kiwi Productions Inc. 1 An Introduction to Object-Oriented Analysis Objects and UML in plain English. Chapter.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 6: Restaurant.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 9: Moving on to Design.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Wixom, and David Tegarden Chapter 8: Behavioral Modeling.
Copyright Flying Kiwi Productions Inc. 1 An Introduction to Object-Oriented Analysis Objects and UML in plain English. Chapter.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED CREATING A SIMPLE PROCESS.
Integrated ISO ILL for staff users Borrowing requests – part two Yoel Kortick 2007.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
Analysis Classes Unit 5.
Based on the book by David William Brown
Systems Analysis and Design with UML Version 2.0, Second Edition
Object-Oriented Systems Analysis and Design Using UML
Chapter 11 Following the Trail; Examining Execution Sequences
Week 12: Activity & Sequence Diagrams
Chapter 10 Object States and The Statechart Diagram
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

Copyright Flying Kiwi Productions Inc. 1 An Introduction to Object-Oriented Analysis Objects and UML in plain English. Chapter 10: Object States and the Statechart Diagram Based on the book by David William Brown John Wiley & Sons, ISBN

Copyright Flying Kiwi Productions Inc. 2 Copyright Copyright Flying Kiwi Productions All rights reserved. This slide presentation is based on “An Introduction to Object- Oriented Analysis; Objects and UML in Plain English,” by David William Brown, Wiley, ISBN , “The Book.” where a copy of The Book is purchased Permission is hereby granted to copy, modify or excerpt all or any part of this slide presentation, provided it is solely for use with courses, seminars or other presentations or productions where a copy of The Book is purchased by or for each and every participant or recipient. An instructor guide is available from the publisher for such presentations.

Copyright Flying Kiwi Productions Inc. 3 Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles Events and States Transitions and Actions The Statechart Diagram Object Lifecycles on the The State Transition Table (STT).

Copyright Flying Kiwi Productions Inc Lifetimes and Lifecycles. Chapter 10: Object States and the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 5 You will remember from Chapter 5... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles.

Copyright Flying Kiwi Productions Inc. 6 Purchase Order A Purchase Order request document, begins life as a request document, authorized gets authorized at various levels, out to a vendor, goes out to a vendor, fulfilled receiving is fulfilled by receiving the goods, archived and finally is archived for future reference. In the real world: Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles.

Copyright Flying Kiwi Productions Inc. 7 predictable cycle Many objects in the real world go through a predictable cycle creation, From their creation, useful life, Through their useful life, l From stage to stage disposed of Until they die or are somehow disposed of (Archived or deleted or whatever.) States in the real world: Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles.

Copyright Flying Kiwi Productions Inc. 8 and something changes about it, we say that it now exists in a differentstate. l We can also say that each time an attribute changes its value, the object now exists in a newstate. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. l l Each time something happens to the object,

Copyright Flying Kiwi Productions Inc. 9 Because any significant business event causes a change of state For at least one business object and... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. Why would we find this so interesting?

Copyright Flying Kiwi Productions Inc. 10 to record these changes in the database In other words... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. l l That means we need some program code

Copyright Flying Kiwi Productions Inc. 11 cause State Changes which cause Object Behaviors Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. Business Events Business Events to be executed.

Copyright Flying Kiwi Productions Inc. 12 actexperience As the act or experience changing from one state to another. of changing from one state to another. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. We define a State Transition

Copyright Flying Kiwi Productions Inc. 13 l As we follow an object from state to state, it traces what we can call its Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. Lifecycle.

Copyright Flying Kiwi Productions Inc. 14 Operations is to discover Operations (i.e., Behaviors) for the classes we found in the earlier steps. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. So our goal in studying Object Lifecycles

Copyright Flying Kiwi Productions Inc. 15 Here’s an example using a library book... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles.

Copyright Flying Kiwi Productions Inc. 16 Your typical library book Begins its day on the shelf... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles.

Copyright Flying Kiwi Productions Inc. 17 Your typical library book Begins its day on the shelf... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. 1. Shelved

Copyright Flying Kiwi Productions Inc. 18 Business Event... This is a Business Event... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. And when a Subscriber comes along and borrows the Book 1. Shelved

Copyright Flying Kiwi Productions Inc. 19 “Signed Out.” Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. The state of the Book changes to 2. Signed Out 1. Shelved

Copyright Flying Kiwi Productions Inc. 20 When the Subscriber brings it back... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles.

Copyright Flying Kiwi Productions Inc. 21 “Checked In.” Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. 1. Shelved The state of the Book changes to 3. Checked In 2. Signed Out 1. Shelved

Copyright Flying Kiwi Productions Inc. 22 The state of the Book changes back to “ Shelved.” Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. 1. Shelved And when the Librarian puts it back on the shelf, 2. Signed Out 3. Checked In 1. Shelved

Copyright Flying Kiwi Productions Inc. 23 “Statechart Diagram.” Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. This is an example of a 1. Shelved 2. Signed Out 3. Checked In

Copyright Flying Kiwi Productions Inc. 24 Operational Lifecycle, concerned with the regular operation of the users’ business. l Many objects have a life that does not repeat, stage to stage But goes stage to stage “birth” “death” from “birth” to “death” (i.e., delete, archive, or whatever.) Life time That kind is called a Life time Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. l l A loop like this is an

Copyright Flying Kiwi Productions Inc. 25 State: State: At any moment, an object exists conditionmanner in a certain condition or manner of being, and this we say is itsState. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. Definition:

Copyright Flying Kiwi Productions Inc. 26 next we must look at two more pieces that make up the Statechart Diagram: Events Events and States States Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. So now that we’ve examined Life times and Life cycles,

Copyright Flying Kiwi Productions Inc. 27 Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles Transitions and Actions The Statechart Diagram Object Lifecycles on the Statechart Diagram The State Transition Table (STT) Events and States.

Copyright Flying Kiwi Productions Inc Events and States. Chapter 10: Object States and the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 29 Event: A noteworthy happening. ( Webster ) Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Events and States.

Copyright Flying Kiwi Productions Inc. 30 received by An Event is received by an object, l Which really means the event happens to happens to that object. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Events and States. We say that:

Copyright Flying Kiwi Productions Inc. 31 The object is in a new state. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Events and States. And once the event has happened to it,

Copyright Flying Kiwi Productions Inc. 32 l To record a business event, change the value one attribute. we must change the value of at least one attribute. represent Since the attribute values can be said to represent the object’s state, this causes a State Transition. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Events and States. l l Generally,

Copyright Flying Kiwi Productions Inc. 33 the domain of its permissible values possible states Gives the set of possible states for that class. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Events and States. In fact, many classes have a “Status” “Status” attribute, and

Copyright Flying Kiwi Productions Inc. 34 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. Now, the last two pieces to complete the Statechart Diagram are...

Copyright Flying Kiwi Productions Inc. 35 Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles Events and States The Statechart Diagram Object Lifecycles on the Statechart Diagram The State Transition Table (STT) Transitions and Actions.

Copyright Flying Kiwi Productions Inc Transitions and Actions. Chapter 10: Object States and the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 37 State Transition: actexperience The act or experience of changing from one state to another. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. Definition:

Copyright Flying Kiwi Productions Inc. 38 states As consisting of the various states that an object may transition through, transitions The set of permissible transitions, sequencing And the sequencing of those states and transitions, as it progresses from its initial creation to its eventual disposal. We define an Object Lifecycle Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions.

Copyright Flying Kiwi Productions Inc. 39 Actionbehavior An Action is a behavior l Associated with a state or transition, each time Executed each time enters or leaves The object enters or leaves that state. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. Action:

Copyright Flying Kiwi Productions Inc. 40 “Signed Out.” Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. When the state of the Book changes to 2. Signed Out 1. Shelved There are some things that must happen, to keep track of all the loans

Copyright Flying Kiwi Productions Inc. 41 “Signed Out.” Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. When the state of the Book changes to 2. Signed Out 1. Shelved 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateTimeIn() When it is loaned out, the Book must in some way be attached to the borrower entry / Loan.L1: Request Link to Subscriber

Copyright Flying Kiwi Productions Inc. 42 “Signed Out.” Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. When the state of the Book changes to 2. Signed Out 1. Shelved 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateTimeIn() And when it leaves the state of “Signed Out,” it must update the Date and Time In. exit / UpdateTimeIn()

Copyright Flying Kiwi Productions Inc. 43 Actionbehavior An Action is a behavior l Associated with a state or transition, each time Executed each time enters or leaves The object enters or leaves that state l or executes that transition. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. Action:

Copyright Flying Kiwi Productions Inc. 44 Action That is, each Action is attached to either the entry into the state, l or the exit from the state. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. Action:

Copyright Flying Kiwi Productions Inc. 45 Action transition Sometimes an Action is attached to a transition and executes during the transition. Action Sometimes an Action is attached to an event, and executes while the object stays within this state. We’ll look at these ones later... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. Action:

Copyright Flying Kiwi Productions Inc. 46 (Or documented separately if too many) Analysis Names At Analysis time, we just want to find Names for the actions, Design to be expanded and spelled out in the Design phase. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. On the Statechart Diagram, Actions may be spelled out within the box for the class

Copyright Flying Kiwi Productions Inc. 47 n Update attributes, n Create instances, n Send messages to other classes, i.e., generate an event to be received by another class and cause a transition in that other class (or even create an instance there.) Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. Actions can do anything:

Copyright Flying Kiwi Productions Inc. 48 cause State Changes which cause Object Behaviors (i.e., Actions ) to be executed. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles. Remember: Business Events

Copyright Flying Kiwi Productions Inc. 49 find Actions Is to find the Actions identify So from them we may identify spec out And later spec out in detail, the Object Behaviors Methods. and Methods. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. goal Statechart Diagram The goal of the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 50 Statechart Diagram... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Transitions and Actions. And the tool for studying and documenting object lifecycles is the

Copyright Flying Kiwi Productions Inc. 51 Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles Events and States Transitions and Actions Object Lifecycles on the Statechart Diagram The State Transition Table (STT) The Statechart Diagram.

Copyright Flying Kiwi Productions Inc The Statechart Diagram. Chapter 10: Object States and the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 53 We need to look at the Statechart notation. Here’s the library book again... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram.

Copyright Flying Kiwi Productions Inc. 54 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram For a Library Book. Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event B1: Subscriber Requests Loan / Update Date & Time Out

Copyright Flying Kiwi Productions Inc. 55 created The event that causes the instance to be created coming from is shown as coming from a large black dot l and is “stereotyped” «create» (e.g., Event B4) Event B2: Subscriber Returns Book 1. Shelved 2. Signed Out 3. Checked In Update Date/time Shelved Event B1: Subscriber Requests Loan Update Date/time Out Generate Event SO1: Request Link to Subscriber Update Date/Time In Generate Event SO2: Archive Sign-Out Event B3: Librarian Shelves Book Event B4: Book is Purchased Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Notation arrows. Events are shown with arrows. Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 56 Eventproject Event numbers are unique within the project Event Event numbers have a prefix telling what class they belong with, e.g.: B 3: Librarian Shelves Book Book  “ B 3: Librarian Shelves Book” belongs in the Book class. L 1: Create Loan Instance Loan  “ L 1: Create Loan Instance” is in the Loan class. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Notation Statewithin that State numbers are unique within that Statechart Diagram e.g., “2: Signed Out” Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 57 Now let’s follow the Book through its daily routine... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Notation Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 58 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Event B4 The Book is purchased ( Event B4 ) and enters State1: Shelved its initial state ( State 1: Shelved ) Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Entry Action As it enters State 1, it executes the Entry Action for that state, Update Date & Time Shelved 

Copyright Flying Kiwi Productions Inc. 59 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram A subscriber (customer) borrows the Book Event B1 ( Event B1 ) Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan State2: Signed Out This causes it to transition to State 2: Signed Out in transition Action As the Book is in transition it executes the Action for that transition: Update Date & Time Out State 2, Then, as it enters State 2, it Entry Action executes the Entry Action for that state, Request Link to Subscriber

Copyright Flying Kiwi Productions Inc. 60 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram. Action: Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Actionbehavior An Action is a behavior l Associated with a state or transition, each time Executed each time enters or leaves The object enters or leaves that state l or executes that transition.

Copyright Flying Kiwi Productions Inc. 61 Action An Action is a set of things that the object must do transitions into or out of when it transitions into or out of a state during or during a transition. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram In other words, Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 62 as it transitions from State 1 to State 2, And And as it enters State 2, generates an Event L1: Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Note that in this case, the Book object Date and Time Out updates the Date and Time Out   Request Link to Subscriber

Copyright Flying Kiwi Productions Inc. 63 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram l l This causes a Loan instance to be created State 1: Current. in its initial state, State 1: Current. Event SO1 The Event SO1 is then received by the Statechart Loan class. Diagram for the Loan class. Update Date/time Out Generate Event SO1: Request Link to subscriber Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan 1. Current Event L1: Request Link to Subscriber «create»

Copyright Flying Kiwi Productions Inc. 64 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Next, Event B2 happens, The Subscriber returns the Book Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan  3. Checked In entry / Loan.L2: Archive Loan And the Book transitions to State 3.

Copyright Flying Kiwi Productions Inc. 65 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Exit Action, it executes the Exit Action, UpdateDateAndTimeIn() As the Book leaves State 2: Signed out Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan exit / UpdateDateAndTimeIn()

Copyright Flying Kiwi Productions Inc. 66 Generate Event L2: Archive Loan Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Entry Action, It executes the Entry Action, Generate Event L2: Archive Loan. State 3: Checked In As the Book enters State 3: Checked In Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 67 Event L2: Loan is Archived / UpdateAverageDurationOfLoan sAllBooks() Event L2 When Event L2 is received by the Statechart Diagram for the Loan class, Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan 1. Current Event L1: Request Link to Subscriber «create» Action executes the Action for that transition: UpdateAverageDurationOfLoansAllBooks() State 2: Archived, The Loan instance Transitions to State 2: Archived, and 2. Archived entry / Update Archive Status

Copyright Flying Kiwi Productions Inc. 68 Event L2: Loan is Archived / UpdateAverageDurationOfLoansAllBooks() Loan Then, as the Loan object enters State 2: Archived, Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan 1. Current Event L1: Request Link to Subscriber «create» Entry Action It executes the Entry Action Update Archive Status Update Archive Status 2. Archived entry / Update Archive Status

Copyright Flying Kiwi Productions Inc. 69 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram l The last two events in the cycle are unrelated: Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan l l Event B3 puts the Book back in State 1: Shelved.

Copyright Flying Kiwi Productions Inc. 70 Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event L2: Loan is Archived / UpdateAverageDurationOfLoansAllBooks() L3 Finally, Timer Event L3 happens Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram 1. Current Event L1: Request Link to Subscriber «create» 2. Archived entry / Update Archive Status Event L3: After(90 days) / Delete Archived Loan After(90 Days) and and deletes all the archived Sign-Outs, after a suitable period. 

Copyright Flying Kiwi Productions Inc. 71 l Note that in this example, Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The Statechart Diagram Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event L2: Loan is Archived / UpdateAverageDurationOfLoansAllBooks() 1. Current Event L1: Request Link to Subscriber «create» 2. Archived entry / Update Archive Status Event L3: After(90 days) / Delete Archived Loan Lifetime, The Loan has a Lifetime, Lifecycle... And the Book has a repeating Lifecycle...

Copyright Flying Kiwi Productions Inc. 72 Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles Events and States Transitions and Actions The Statechart Diagram The State Transition Table (STT) Object Lifecycles on the Statechart Diagram.

Copyright Flying Kiwi Productions Inc Object Lifecycles on the Statechart Diagram. Chapter 10: Object States and the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 74 class This pattern depends on the class of the object: All instances in a class have the same pattern. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram. set pattern Many objects have a set pattern of stages or states they go through.

Copyright Flying Kiwi Productions Inc. 75 l Which can come from the outside world, l Or from another object within the system. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram. l l An object moves from state to state Event, in response to an Event,

Copyright Flying Kiwi Productions Inc. 76 physicallylegally impossible. Some are physically or legally impossible. l Constraints in the users’ world will preclude many of these transitions. permissible ones Only the permissible ones are modeled. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram. l l Not all transitions from one state to another are permitted.

Copyright Flying Kiwi Productions Inc. 77 An Object Lifecycle consists of the various states that an object may transition through, The set of permissible transitions, and the sequencing of those states and transitions. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram. Definition:

Copyright Flying Kiwi Productions Inc. 78 for each state, event and transition, Actions Actions that are executed each time the object enters or leaves that state or executes the transition Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram. The Lifecycle also includesActions

Copyright Flying Kiwi Productions Inc. 79 Pick the classes you figure will have an “Interesting Lifecycle,” Also include those with a lifetime linked with the “interesting” ones. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram But which classes need a Statechart Diagram?

Copyright Flying Kiwi Productions Inc. 80 operational life cycle A repeating operational life cycle (e.g., Library Book), complex life time A complex life time with branches and backtracks (e.g., Purchase Order), long lifetime A long lifetime with many states, Actionsoperations. Anything you judge may be a fruitful source of Actions and operations. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram “Interesting” By “Interesting” I mean those with:

Copyright Flying Kiwi Productions Inc. 81 l Since all instances in a class have the same lifecycle, Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram same Statechart Diagram. It follows that they all have the same Statechart Diagram. executing its Statechart Diagram, However, for executing its Statechart Diagram, separate instance own pace, Each separate instance proceeds at its own pace, l l As events arrive to step it through its lifecycle. We have a name for this...

Copyright Flying Kiwi Productions Inc. 82 A State Machine is the set of actual historical events actual historical events that took place during the execution of a Statechart Diagram by a particular specified by a particular specified object instance. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram Definition:

Copyright Flying Kiwi Productions Inc. 83 It may also include the future events that will make up the rest of the path that this instance will take through the Statechart Diagram. Definition: State Machine Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 84 This is different from the Statechart Diagram itself which may be viewed as abstraction an abstraction State Machines of the State Machines of all the instances. Definition: State Machine Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 85 That you must use on every Statechart Diagram... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram Object Lifecycles on the Statechart Diagram And now a Completeness Check

Copyright Flying Kiwi Productions Inc. 86 Chapter 10: Object States and the Statechart Diagram 10.1 Lifetimes and Lifecycles Events and States Transitions and Actions The Statechart Diagram Object Lifecycles on the Statechart Diagram The State Transition Table (STT).

Copyright Flying Kiwi Productions Inc The State Transition Table (STT). Chapter 10: Object States and the Statechart Diagram

Copyright Flying Kiwi Productions Inc. 88 l l Let’s take another quick look at the Library Book Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT) Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 89 l l We need to check that every possible transition has been: destination state, Assigned a destination state, or impossible, Ruled as physically or legally impossible, or ignored. Designated as one that should be ignored. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT) Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 90 l l Here is a matrix tool that will help you do that, l It’s called a State Transition Table... Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT) Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 91 State Transition Table Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT)States Events 1. Shelved 2. Signed Out 3. Checked In 0. Null B1: Subscriber Requests Loan Requests Loan B2: Subscriber Returns Book Returns Book B4: Book is Purchased is Purchased B3: Librarian Shelves Book Shelves Book Impossible ImpossibleImpossible Impossible Impossible Impossible Ignore Impossible Impossible Impossible Impossible ?? l But what about the blank in the bottom leftmost box? Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan l l What happens if a loan is requested while the Book is in the Checked-In bin, waiting to go back on the shelf?

Copyright Flying Kiwi Productions Inc. 92 to refuse to lend a book when it is available from the Checked-In bin! highlighted a deficiency So our State Transition Table has highlighted a deficiency in the Statechart Diagram. Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT) l l It would not make sense, our users tell us, Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan

Copyright Flying Kiwi Productions Inc. 93 Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT) Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan l So we add an arrow from State 3 to State 2 Event B1: Loan Requested Triggered by an Event B1: Loan Requested Event B1: Subscriber Requests Loan / Update Date/Time Out Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event B1: Subscriber Requests Loan / Update Date/Time Out

Copyright Flying Kiwi Productions Inc. 94 State Transition Table Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT)States Events 1. Shelved 2. Signed Out 3. Checked In 0. Null B1: Subscriber Requests Loan Requests Loan B2: Subscriber Returns Book Returns Book B4: Book is Purchased is Purchased B3: Librarian Shelves Book Shelves Book Impossible ImpossibleImpossible Impossible Impossible Impossible Ignore Impossible Impossible Impossible Impossible And we put a ‘2’ as And we put a ‘2’ as the destination state in the bottom left box. And we put a ‘2’ as And we put a ‘2’ as the destination state in the bottom left box. 2 Event B1: Subscriber Requests Loan Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event B1: Subscriber Requests Loan / Update Date/Time Out

Copyright Flying Kiwi Productions Inc. 95 State Transition Table Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT)States Events 1. Shelved 2. Signed Out 3. Checked In 0. Null B1: Subscriber Requests Loan Requests Loan B2: Subscriber Returns Book Returns Book B4: Book is Purchased is Purchased B3: Librarian Shelves Book Shelves Book Impossible ImpossibleImpossible Impossible Impossible Impossible Ignore Impossible Impossible Impossible Impossible And we put a ‘2’ as And we put a ‘2’ as the destination state in the bottom left box. And we put a ‘2’ as And we put a ‘2’ as the destination state in the bottom left box. 2  Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event B1: Subscriber Requests Loan / Update Date/Time Out

Copyright Flying Kiwi Productions Inc. 96 State Transition Table Chapter 10: Object States and the Statechart Diagram Chapter 10: Object States and the Statechart Diagram The State Transition Table (STT)States Events 1. Shelved 2. Signed Out 3. Checked In 0. Null B1: Subscriber Requests Loan Requests Loan B2: Subscriber Returns Book Returns Book B4: Book is Purchased is Purchased B3: Librarian Shelves Book Shelves Book Impossible ImpossibleImpossible Impossible Impossible Impossible Ignore Impossible Impossible Impossible Impossible 2 Event B1: Subscriber Requests Loan / Update Date/Time Out Event B2: Subscriber Returns Book Event B3: Librarian Shelves Book Event B4: «create» Book is Purchased 2. Signed Out entry / Loan.L1: Request Link to Subscriber exit / UpdateDateAndTimeIn() 1. Shelved entry / Update Date & time Shelved 3. Checked In entry / Loan.L2: Archive Loan Event B1: Subscriber Requests Loan / Update Date/Time Out

Copyright Flying Kiwi Productions Inc. 97 End of Chapter 10

Copyright Flying Kiwi Productions Inc. 98 End of Chapter 10

Copyright Flying Kiwi Productions Inc. 99 End of Chapter 10

Copyright Flying Kiwi Productions Inc. 100 End of Chapter 10

Copyright Flying Kiwi Productions Inc. 101

Copyright Flying Kiwi Productions Inc. 102

Copyright Flying Kiwi Productions Inc. 103

Copyright Flying Kiwi Productions Inc. 104