Information Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 1IV. State DiagramsIV. State DiagramsState DiagramsEvents and StatesSuperstatesInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 2State Diagrams (Statecharts)State Diagrams (Statecharts) State diagrams model processes (business processes,machine processes, or anything in-between.) States Transitions Events, conditions and actions (all optional)Event[Condition]/Action Initial and final statesInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 3State Diagram for Purchase OrderState Diagram for Purchase Orderorder receivedCheckingDo/check itemsDispatchingDo/package items[some item notIn stock?]WaitingItem received[some item notIn stock?]Item received[all items in stock?][all items in stock?]/deliver packagestart/initialeventconditionactionend/finalInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 4EventsEvents An event is a happening that the system needs toknow about. In UML, there are four types of events:Change events occur when a condition becomestrue, e.g., when(balance < 0);Signal events designate the receipt of an explicit(real-time) signal from outside;Call events indicate the receipt of a call forexecution from outside;Time events mark the passage of a designatedperiod of time from the moment a state wasentered/exited,e.g., after(10 seconds)Information Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 5Course LifetimesCourse LifetimesInitializationOpenClosedCancelledofferNewCourse/set count=0;create(CourseRoster)[count=10] addStudent [count<10]cancelcancel/delete(CourseRoster)quarterStarted[Lochovsky98]end stateInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 6StatesStates A state represents a time period during which A predicate is true, e.g., budget - expenses >0, An action is being performed, or Someone waits for an event to happen. A state can be “on” or “off”. States can have associated activities. Special activityconstructs include: do/stateDiagramName(parameterList) -- “calls” anotherstate diagram; entry/action -- carry out the action when entering theactivity; exit/action -- carry out the action when exiting;Information Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 7createCourse/count=0;CourseRoster.Create()[count=10]addStudent[count<10]cancelcancelCourseRoster.Delete()quarterStartedCloseddo/FinalizeCourseCancelledentry/RegisterStudentexit/CourseRoster.AddStudent(student)OpenInitializationdo / InitializeCourse Lifetimes, AgainCourse Lifetimes, AgainInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 8 A superstate consists of two or more substates. There are AND and OR superstates. When an AND superstate is “on”, all its states arealso “on”. When an OR superstate is “on”, one of its states is“on”.SuperstatesSuperstatesInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 9An OR SuperstateAn OR SuperstateNeutralForwardReverseTransmissionselect Rselect Nselect Fselect NInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 10Neutral ReverseTransmissionselect Rselect Nselect Fselect NSecondFirst ThirdForwardupshiftupshiftdownshiftdownshiftstop……More on More on TransmissionTransmissionInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 11CancelledDeliveredRejectedCheckingWaitingDispatchingAuthorizingAuthorizedAn AND SuperstateAn AND SuperstatecancelJoin (unlabelledoutgoing transition)ForkrejectapproveInformation Systems Analysis and Design CSC340© 2004 John Mylopoulos State Diagrams -- 12Additional ReadingsAdditional Readings [Booch99] Booch, G. et al., The Unified Modeling LanguageUser Guide, Chapters 19, 20, 21, 24. Addison-Wesley. [Fowler00] Fowler, M., UML Distilled: A Brief Guide to theStandard Object Modelling Language, Chapters 8, 9.
View Full Document