Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2008 Prentice Hall, Ovidiu Noran Lecture 7b 1 Modelling OO Logic Requirements: Sequence Diagrams and Activity Diagrams (Textbook Chapter 8, Appendix)

Similar presentations


Presentation on theme: "© 2008 Prentice Hall, Ovidiu Noran Lecture 7b 1 Modelling OO Logic Requirements: Sequence Diagrams and Activity Diagrams (Textbook Chapter 8, Appendix)"— Presentation transcript:

1 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 1 Modelling OO Logic Requirements: Sequence Diagrams and Activity Diagrams (Textbook Chapter 8, Appendix)

2 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 2 Learning Objectives Understand how to detail use cases and represent some system logic with sequence diagrams. Understand how to represent processes and system logic with activity diagrams. Understand the relationship between different types of diagrams

3 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 3 Interaction and Activity Diagrams Use Case diagrams are too simple to show details of the interactions among objects within a use case. In addition to written use cases, Interaction Diagrams (Sequence and Collaboration) are used to detail the interactions taking place in a use case Activity Diagrams are used to show the conditional logic for the sequence of system activities needed to accomplish a business process.

4 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 4 Dynamic Modelling: Sequence Diagrams Sequence diagram: depicts the interactions among objects during a certain period of time. May be presented either in a generic form or in an instance form. Generic form shows all possible sequences of interactions, corresponding to all the scenarios of a use case. Instance form shows the sequence for only one scenario (a specific combination of conditions within a use case (Fowler, 2000))

5 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 5 Elements of a sequence diagram  Objects: represented by boxes at top of diagram.  Lifeline: the time during which an object exists.  Messages: means by which objects communicate with each other. Objects (derived out of classes) and messages are essential elements of the OO approach. More in future lectures… Sequence Diagrams (Cont.)

6 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 6 Activation: the time period during which an object performs an operation. Synchronous message: a type of message in which the caller has to wait for the receiving object to finish executing the called operation before it can resume execution itself. Sequence Diagrams (Cont.)

7 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 7 Simple message: a message that transfer control from the sender to the recipient without describing the details of the communication. Asynchronous message: a message in which the sender does not have to wait for the recipient to handle the message. Sequence Diagrams (Cont.)

8 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 8 Scenario modelled: Class registration. Assumptions: course has no prerequisites 1. Registration Clerk opens the registration window and enters the registration information 2. Check if the class is open 3. If the class is open, check if the course has any prerequisites. 4. Assumed course has no prerequisites. Register the student for the class; increment the class size by one. 5. Check if the class ifs full; if not, do nothing 6. Display the confirmed registration in the registration window Sequence Diagrams (Cont.)

9 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 9 Sequence diagram for a class registration scenario without prerequisites ObjectName: ClassName ‘Non-persistent’ (control) object Lifeline No response shown. (assumption: class open) Guard conditions ‘Self delegation’ (call upon one’s own operation(s) (Object destroys itself) Activation (performs operation) Synchronous message (all shown are synchronous) Anonymous Object Named Object (‘a New Registration’)

10 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 10 Scenario modelled: Class registration. Assumptions: course has prerequisites, class not full 1. Registration Clerk opens the registration window and enters the registration information 2. Check if the class is open 3. If the class is open, check if the course has any prerequisites. Assumed course has prerequisites. 4. If the student has taken the prerequisites, then register the student for the class and increment the class size by one. 5. Check if the class ifs full; assumed class not full. 6. Display the confirmed registration in the registration window Sequence Diagrams (Cont.)

11 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 11 Sequence diagram for a class registration scenario with prerequisites Guard condition for existing prerequisites In this scenario, assume class not full Time

12 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 12 A sequence diagram for “Prerequisite Courses Not Completed” use case Student has not taken prerequisites Scenario:

13 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 13 Process Modelling: Activity Diagrams Elements of Activity Diagrams:  Activity: a behavior that an object carries out while in a particular state.  Transition: a movement from one activity or state to another.  Branch: a diamond symbol containing a condition whose results provide transitions to different paths of activities.

14 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 14 Activity Diagram for a Customer Order Process Time

15 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 15 Process Modelling: Activity Diagrams (Cont.)  Synchronization bar: horizontal or vertical bars denoting parallel or concurrent paths of activities. Fork: the beginning of parallel activities. Join: the end of parallel activities.  Swimlanes: columns representing different organisational units of the system.

16 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 16 Process Modelling: Activity Diags (Cont.)

17 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 17 Process Modelling: Activity Diags (Cont.)

18 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 18 Hospital Pharmacy Level-0 DFD 2.0 Review Prescription Order by Station 3.0 Fill Order 4.0 Generate Label Nurses Station Doctor Billing Dept D1 Patient File Prescription Unfilled Order Info Unfilled Order Info Response Order Info Patient Number and Drug Type, Amount & Cost Pharmacy Tech Review Prescription Prescription Order Fill Info 1.0 Review & Send Prescription to Station Drug Label Info Patient Info Comparing Activity Diagrams with DFDs Processes are shown in both diagrams. HOWEVER… -No time dimension, hence no synchronisation, etc features -No explicit decision logic (remember how it can be suggested in DFDs ??

19 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 19 Relationship of OO techniques / diagrams Source: (Satzinger et. al, 2008)

20 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 20 Summary In this appendix you had the opportunity to learn how to: Understand how to detail use cases and represent some system logic with sequence diagrams. Understand how to represent system logic with activity diagrams. Understand the relationship between different types of diagrams

21 © 2008 Prentice Hall, Ovidiu Noran Lecture 7b 21 References  Fowler, M. 2000. UML Distilled: A Brief Guide to the Object Modelling Language. 2 nd Ed. Reading, MA: Addison Wesley  Satzinger, G., Jackson, R.Burd, S. 2008. Systems Analysis and Design in a Changing World. 5 th Ed. Course Technology


Download ppt "© 2008 Prentice Hall, Ovidiu Noran Lecture 7b 1 Modelling OO Logic Requirements: Sequence Diagrams and Activity Diagrams (Textbook Chapter 8, Appendix)"

Similar presentations


Ads by Google