Chapter 4,Use Case and Statechart Diagrams

Slides:



Advertisements
Similar presentations
Writing Good Use Cases - Instructor Notes
Advertisements

Use Case Diagrams.
© 2005 by Prentice Hall Appendix 3 Object-Oriented Analysis and Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design 1.
Chapter 7 – Design and Implementation
Week 2 The Object-Oriented Approach to Requirements
Requirements Diagrams With UML Models
Use Case Diagrams.
Quiz 1.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML.
SEQUENCE DIAGRAM. UML diagrams There are many ways of organizing the UML diagrams. Can be organized as the fallowing: 1. Structural diagrams: to show.
25 seconds left…...
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 4, Requirements Elicitation.
Slides by Bruegee and Dutoit, Modified by David A. Gaitros COP 3331 Object Oriented Analysis and Design Chapter 2: Object Oriented Modeling using UML Jean.
Chapter 2, Modeling with UML, Part 2
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
Interaction Diagrams Software Engineering BIT8. Interaction Diagrams  A series of diagrams describing the dynamic behavior of an object-oriented system.
Requirements Engineering Processes
Systems Analysis and Design in a Changing World, Fourth Edition
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 UML Sequence Diagrams  Used during system.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Using UML, Patterns, and Java Object-Oriented Software Engineering Modeling with UML Chapter 2 Object-Oriented Software Engineering: Using UML, Patterns,
1 Modeling with UML CMPE 131 Fall Overview What is modeling? What is UML? Use case diagrams Class diagrams Sequence diagrams Activity diagrams.
Blaha and Rumbaugh Sections 7.2 and 8.2
1 Lab Beginning Analysis and Design 4 Completion of first version of use case diagram initiates the processes of analysis and design. 4 UML provides.
Chapter 7: The Object-Oriented Approach to Requirements
SEQUENCE DIAGRAM Prepared by: T. Fatimah Alageel.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 Functional Modeling.
Course information and deadline reminders
1 Behavioral diagrams (2) Lecture p5 T120B pavasario sem.
Modeling with UML Chapter 2 Object-Oriented Software Engineering: Using UML, Patterns, and Java, 2 nd Edition By B. Bruegge and A. Dutoit Prentice Hall,
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 20. Review Software Requirements Requirements Engineering Process.
UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Chapter 2, Modeling with UML, Part 2
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: Review Session (Optional)
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 2, Modeling with UML: Review Session (Optional)
7 Systems Analysis and Design in a Changing World, Fifth Edition.
UML Review of diagram types. 2 Unified Modeling Language The Unified Modeling Language™ (UML) was developed jointly by Grady Booch, Ivar Jacobson, and.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
1 An Introduction to UML Interaction (Sequence and Communication) Diagrams Georgia State University CIS 3300 Spring, 2009.
Drawing System Sequence Diagrams
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Software Engineering September 19, 2001 UML.
UNIFIED MODELING LANGUAGE(UML) BY Touseef Tahir Lecturer CS COMSATS Institute of Information Technology, Lahore.
Introduction to UML 임현승 강원대학교 Revised from the slides by Bernd Bruegge and Allen H. Dutoit for the book “Object-Oriented Software Engineering: Using UML,
Using UML, Patterns, and Java Object-Oriented Software Engineering More on UML Note: Slides are adapted by Linda Sherrell from the Software Engineering.
Using UML, Patterns, and Java Object-Oriented Software Engineering Art for Chapter 1, Introduction to Software Engineering.
Systems Analysis and Design in a Changing World, Fourth Edition
UML Review of Use case diagrams. 2 Unified Modeling Language The Unified Modeling Language™ (UML) was developed jointly by Grady Booch, Ivar Jacobson,
UML Review Overview: modeling with UML  What is modeling?  What is UML?  Use case diagrams  Class diagrams  Sequence diagrams  Activity diagrams.
CEN 5011 Advanced Software Engineering
 The Sequence Diagram models the collaboration of objects based on a time sequence.  It shows how the objects interact with others in a particular scenario.
7 Systems Analysis – ITEC 3155 The Object Oriented Approach – Use Cases.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
1 After the scenarios are formulated Find all the use cases in the scenario Describe each of these use cases in more detail Participating actors Describe.
1 Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 14 Slide 1 Object-Oriented Design.
UML CSE 470 : Software Engineering. Unified Modeling Language UML is a modeling language to express and design documents, software –Particularly useful.
Systems Analysis and Design in a Changing World, Fourth Edition
Chapter 2, Modeling with UML
UML Review.
Before we start Project Group A note about class project ArgoUML
CS410 – Software Engineering Lecture #17: UML I
Chapter 2, Modeling with UML
Chapter 2, Modeling with UML
CS410 – Software Engineering Lecture #9: UML
Presentation transcript:

Chapter 4,Use Case and Statechart Diagrams

Outline of this Class Use case diagrams Class diagrams Describe the functional behavior of the system as seen by the user Class diagrams Describe the static structure of the system: Objects, attributes, associations Sequence diagrams Describe the dynamic behavior between objects of the system Statechart diagrams Describe the dynamic behavior of an individual object Activity diagrams Describe the dynamic behavior of a system, in particular the workflow. Use case diyagramı, sistemin kullanıcılar gözünde nasıl işlediğini, fonksiyonel davranışlarını betimler.

Another view on UML Diagrams

UML Use Case Diagrams Passenger PurchaseTicket Used during requirements elicitation and analysis to represent external behavior (“visible from the outside of the system”) Passenger An actor represents a role, that is, a type of user of the system. A use case represents a class of functionality provided by the system. PurchaseTicket Use case model: The set of all use cases that completely describe the functionality of the system.

Use Case Example Handle Returns Main Success Scenario: A customer arrives at a checkout with items to return. The cashier uses the POS system to record each returned item. Alternate Scenarios: If they paid by credit, and the reimbursement transaction to their credit account is rejected, inform the customer and play them with cash. If the item identifier is not found in the system, notify the Cashier and suggest manual entry of the identifier code. If the system detects failure to communicate with the external accounting system, .....

Actors An actor is a model for an external entity which interacts (communicates) with the system: User External system (Another system) Physical environment (e.g. Weather) An actor has a unique name and an optional description Examples: Passenger: A person in the train GPS satellite: An external system that provides the system with GPS coordinates. Passenger Optional Description Name

Use Case • A use case represents a class of functionality provided by the system. • Use cases can be described textually, with a focus on the event flow between actor and system. • The textual use case description consists of 6 parts: Unique name Participating actors Entry conditions Exit conditions Flow of events Special requirements. PurchaseTicket

Textual Use Case Description Example Passenger Textual Use Case Description Example PurchaseTicket 1. Name: Purchase ticket 2. Participating actor: Passenger 3. Entry condition: Passenger stands in front of ticket distributor Passenger has sufficient money to purchase ticket 4. Exit condition: Passenger has ticket 5. Flow of events: 1. Passenger selects the number of zones to be traveled 2. Ticket Distributor displays the amount due 3. Passenger inserts money, at least the amount due 4. Ticket Distributor returns change 5. Ticket Distributor issues ticket 6. Special requirements: None.

Uses Cases can be related Extends Relationship To represent seldom invoked use cases or exceptional functionality Includes Relationship To represent functional behavior common to more than one use case.

The <<extends>> Relationship <<extends>> relationships model exceptional or seldom invoked cases The exceptional event flows are factored out of the main event flow for clarity The direction of an <<extends>> relationship is to the extended use case Use cases representing exceptional flows can extend more than one use case. Passenger PurchaseTicket <<extends>> <<extends>> <<extends>> <<extends>> OutOfOrder TimeOut Cancel NoChange

The <<includes>> Relationship <<includes>> relationship represents common functionality needed in more than one use case. <<includes>> behavior is factored out for reuse, not because it is an exception. The direction of a <<includes>> relationship is to the using use case (unlike the direction of the <<extends>> relationship). Two use cases are related by an include relationship, if one of them includes the second one in its own flow of events. Passenger PurchaseMultiCard PurchaseSingleTicket <<includes>> <<includes>> CollectMoney NoChange <<extends>> Cancel

Example of <<includes>> relationship - 1

Example of <<includes>> relationship - 2

Example of <<includes>> relationship - 3

Example of <<extends>> relationship

Textual Use Case Description Example Student DoHomework Textual Use Case Description Example 1. Name: DoHomework 2. Participating actor: Student 3. Entry condition: Student received exercise sheet Student is in good health 4. Exit condition: Student delivered solution 5. Flow of events: 1. Student fetches the exercise sheet 2. Student reads through the assignments 3. Student processes the assignments and types the solution in his Computer. 4. Student prints out the solution 5. Student delivers the solution in the following exercise 6. Special requirements: None.

Sınıf Çalışması (10 dakika) - Müşteri, garsona sipariş verir. Restoranda çalışmak isteyen adayların başvurularını restoran yöneticisi değerlendirir. İşe alımları da o yapar. Restoranda kullanılan malzemeler için düzenli sipariş verilmesi gerekmektedir. Malzemeler belirli bir tedarikçiden sağlanır. Malzemelerin siparişini restoran yöneticisi verir. Bunu yaparken, sürekli olarak satışları ve stokları takip etmesi gerekir. Stokları takip etmek için, restoran yöneticisinin tuttuğu düzenli raporlar bulunur.

<<uses>> Sınıf Çalışması Order Food Hire Employee Reorder supplies Produce mgt. reports Track sales and inv. data <<uses>> Customer Applicant Supplier Service Person Manager

Another view on UML Diagrams

Sequence Diagrams Focus on Controlflow Used during analysis Passenger Used during analysis To refine use case descriptions to find additional objects (“participating objects”) Used during system design to refine subsystem interfaces Instances are represented by rectangles. Actors by sticky figures Lifelines are represented by dashed lines Messages are represented by arrows Activations are represented by narrow rectangles. TicketMachine selectZone() pickupChange() pickUpTicket() insertCoins() zone2price selectZone() insertCoins() pickupChange() pickUpTicket() TicketMachine Messages -> Operations on participating Object

Sequence Diagrams can also model the Flow of Data Passenger selectZone() ZoneButton TarifSchedule Display lookupPrice(selection) displayPrice(price) price Dataflow …continued on next slide... The source of an arrow indicates the activation which sent the message Horizontal dashed arrows indicate data flow, for example return results from a message

Messages Define a particular communication between lifelines of an interaction Examples of communication raising a signal invoking an operation creating or destroying an instance Specify (implicitly) sender and receiver are shown as a line from the sender to the receiver Form of line and arrowhead reflect message properties

Message Types Asynchronous Synchronous Call and Object creation Reply Lost Found Senkron mesaj: Okun ucunun içi dolu: Bir nesnenin mesajı gönderdikten sonra, zaman çizelgesinde devam edebilmesi için, karşı nesneden cevap beklemesi gereken durumlarda kullanılır. Oldukça sık kullanılmaktadır. Asenkron mesaj: Okun içi boş. Bir nesnenin mesajı gönderdikten sonra, zaman çizelgesine devam edebilmesi için karşı nesneden cevaba ihtiyaç duymadığı durumlarda kullanılır. Lost messages: Yollanmış ama ya alıcısına ulaşmamış veya diyagram üzerinde tanımlanmamış bir alıcıya giden mesajlardır. Found messages: Kimden geldiği belli olmayan veya geldiği nesnenin diyagramda gösterilmediği mesajlardır. Self messages: Ya nesnelerin yine kendine gönderdiği mesajlar nesneler veya bir nesnenin bir metodunun, yine kendi içindeki bir başka metoda gönderdiği mesajlar. Reply: Mesaj gönderilen nesneden gelen veriyi gösterir.

Lifeline and Execution Specification A lifeline represents an individual participant (or object) in the interaction A lifeline is shown using a symbol that consists of a rectangle forming its “head” followed by a vertical line (which may be dashed) that represents the lifetime of the participant An execution specification specifies a behavior or interaction within the lifeline An execution specification is represented as a thin rectangle on the lifeline.

Sequence Diagrams: Iteration & Condition Passenger …continued from previous slide... CoinIdentifier Display CoinDrop ChangeProcessor * insertChange(coin) lookupCoin(coin) price Iteration displayPrice(owedAmount) Condition [owedAmount<0] returnChange(-owedAmount) …continued on next slide... Iteration is denoted by a * preceding the message name Condition is denoted by boolean expression in [ ] before the message name

Creation and destruction Passenger …continued from previous slide... Creation of Ticket ChangeProcessor Ticket createTicket(selection) print() Destruction of Ticket free() Creation is denoted by a message arrow pointing to the object Destruction is denoted by an X mark at the end of the destruction activation In garbage collection environments, destruction can be used to denote the end of the useful life of an object.

Sequence diagram: An Example Lifeline Execution Specification Message Sequence diagrams represent the behavior of a system as messages (“interactions”) between different objects.

Sequence Diagram - Ex

Sequence Diagram - Ex

Sequence diagram: An Example

Sequence diagram: An Example İçi dolu ok= Senkronize ok= O nesnenin aktivasyonuna devam edebilmesi için, mesaj gönderdiği nesneden cevap alması lazım.

Sequence Diagram Properties UML sequence diagram represent behavior in terms of interactions Useful to identify or find missing objects Time consuming to build, but worth the investment Complement the class diagrams (which represent structure).

Sınıf Çalışması (15 dakika) Müşterinin ATM’den para çekmek istemesine ait sıralama (sequence) diyagramını çiziniz. Sokulan kart kontrol edilmeli. Eğer onaylanırsa, müşterinin istediği miktar kontrol edilmeli. Eğer onaylanırsa, işlem başlatılmalı. Para verildikten sonra, müşteriye dekont verilmesi. Müşteri hesabında yapılan işlemlerin kaydedilmesi.

Örnek Çözüm

Another view on UML Diagrams

UML first pass: Statechart diagrams Initial state Event button1&2Pressed button1Pressed button2Pressed Increment Minutes Hours Blink Seconds Stop Blinking Transition State Final state Represent behavior of a single object with interesting dynamic behavior.

How to draw statechart diagrams? Identify important objects to be analyzed. Identify the states. Identify the events.

Statechart Diagram Example

Statechart Diagram Example

UML Summary UML provides a wide variety of notations for representing many aspects of software development Powerful, but complex UML is a programming language Can be misused to generate unreadable models Can be misunderstood when using too many exotic features We concentrated on a few notations: Functional model: Use case diagram Object model: class diagram Dynamic model: sequence diagrams, statechart and activity diagrams