tailieunhanh - Ebook UML @ Classroom An Introduction to Object-Oriented Modeling: Part 2

Ebook UML @ Classroom An Introduction to Object-Oriented Modeling: Part 2 presents the following content: The Sequence Diagram; The Activity Diagram; All Together Now; Further Topics. Please refer to the documentation for more details. | Chapter 5 The State Machine Diagram Over the course of its life every system or to be more precise every object goes through a finite number of different states. Using a state State machine diagram machine diagram you can model the possible states for the system or object in question how state transitions occur as a consequence of oc- curring events and what behavior the system or object exhibits in each state. As a simple example consider a lecture hall that can be in one of two states free or occupied. When a lecture starts in the lecture hall the state of the lecture hall changes from free to occupied. Once the respective event in the lecture hall has finished and the hall has been released again its state reverts to free see Fig. . lecture start Figure free occupied State machine diagram of release a lecture hall simplified presentation The state machine diagram is based on the work of David Harel 22 and uses concepts of finite automata. UML differentiates between two types of state machines namely behavior state machines and protocol state machines. In this book we present only behavior state machines which are widespread in practice and are also referred to as state ma- chine diagrams or state charts. In the same way as every other diagram a state machine diagram only models the part of a system that is necessary or relevant for the respective purpose. For example if you want to model only the states that a lecture hall can take either for collecting requirements or for doc- umentation purposes a model as shown in Figure can be sufficient. However if you are already in a late phase of the development process a representation that is close to code as shown in Figure is ben- Springer International Publishing Switzerland 2015 85 M. Seidl et al. UML @ Classroom Undergraduate Topics in Computer Science DOI 978-3-319-12742-2_5 86 5 The State Machine Diagram eficial. This figure shows a class LectureHall with an attribute free that can take the .