1 Object Oriented Analysis and Design with UML UNIT 3.

Slides:



Advertisements
Similar presentations
© 2005 by Prentice Hall Appendix 3 Object-Oriented Analysis and Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
Advertisements

Object-Oriented Software Engineering Visual OO Analysis and Design
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
1 Behavioral Modeling Chapter 8. 2 Key Ideas Behavioral models describe the internal dynamic aspects of an information system that supports business processes.
Introduction to Software Engineering 7. Modeling Behaviour.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
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.
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.
Object-Oriented Analysis and Design
Software Engineering COMP 201
Jerry Gao Ph.D.9/2001 The UML: Object-Oriented Modeling The Unified Modeling Language (UML) Instructor: Jerry Gao Ph.D. San Jose State University
Slide 10B.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Essentials of interaction diagrams Lecture 23 & 24.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Dynamic modeling using UML
© Copyright Eliyahu Brutman Programming Techniques Course.
State Change Modelling. Aim: To introduce the concept and techniques for describing the changes in state that may occur to an object in its lifetime.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
7M822 UML Interaction Diagrams 25 November 2010.
SE-565 Software System Requirements More UML Diagrams.
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.
Unified Modeling Language
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Slide 16B.51 © The McGraw-Hill Companies, 2005 Object-Oriented and Classical Software Engineering.
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 25. Review Design Level Class Diagram Identifying classes/Operations/Attributes Associations – Simple associations.
Functional Modeling Question How do you know if you have enough information to compute the necessary output values? How do you know if you have.
Systems Analysis and Design in a Changing World, Fifth Edition
Copyright 2002 Prentice-Hall, Inc. Chapter 2 Object-Oriented Analysis and Design Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
Systems Analysis and Design in a Changing World, 3rd Edition
Software Engineering Prof. Ing. Ivo Vondrak, CSc. Dept. of Computer Science Technical University of Ostrava
7 Systems Analysis and Design in a Changing World, Fifth Edition.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
OO Methodology Elaboration Iteration 3 – Part 2 Refining Models.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
© 2008 Prentice Hall, Ovidiu Noran Lecture 7b 1 Modelling OO Logic Requirements: Sequence Diagrams and Activity Diagrams (Textbook Chapter 8, Appendix)
Logical view –show classes and objects Process view –models the executables Implementation view –Files, configuration and versions Deployment view –Physical.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
UNIFIED MODELING LANGUAGE(UML) BY Touseef Tahir Lecturer CS COMSATS Institute of Information Technology, Lahore.
CSCI-383 Object-Oriented Programming & Design Lecture 12.
Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
Dynamic Models Sequence Diagrams Collaboration Diagrams Activity Diagrams.
Systems Analysis and Design in a Changing World, Fourth Edition
1 LAB What is Collaboration diagram? 4 Collaboration diagrams illustrate the interaction between the objects, using static spatial structure. 4.
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.
UML Activity Diagrams.
Chapter 3: Introducing the UML
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
1 Kyung Hee University Interaction Diagrams Spring 2001.
1 7 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 7 The Object-Oriented Approach to Requirements.
Project 2: Phase 1 Submission 7 Late submissions 10% 10 No submissions 14% Better than project 1 phase 3 submissions 10-point bonus: If you catch the deadline.
Systems Analysis and Design in a Changing World, Fourth Edition
Appendix 3 Object-Oriented Analysis and Design
Analysis Classes Unit 5.
Object-Oriented Analysis and Design
Unified Modeling Language
Business System Development
Object Oriented System Design
Unified Modelling Language
CIS 375 Bruce R. Maxim UM-Dearborn
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

1 Object Oriented Analysis and Design with UML UNIT 3

2 Summary Unit UML Overview –Model systems using OO concepts Information systems, technical systems, system software, real time, distributed system,… –UML is a modeling language –Based on the notion of views Use case, logical, component, concurrency, deployment view

3 Summary Unit 2... –UML Diagrams –Extensibility of the UML Stereotypes, tagged values, constraints 4 Use-Case diagram 4 Class diagram 4 Object diagram 4 State diagram 4 Sequence diagram 4 Collaboration diagram 4 Activity diagram 4 Component diagram 4 Deployment diagram

4 Summary Unit Static Modeling with UML –Use Case Diagrams to capture the functional requirements of a system informally stated in natural language focus on what the system is supposed to do –Class Diagrams A view of the system in terms of classes and relationships Behaviour as well as information in the system is modeled –This static model of the system is built in a dynamic way !!

5 Use-Case Diagram CustomerOperator Return Item Print Daily Report Change Item Data

6 Steps for Building a Use Case Model 4 Define the boundaries of the system 4 Find the actors and use cases 4 Define the relationships between the use cases 4 Validate and verify the model –Highly interactive with the end users ! –Should include discussions Be Creative !

7 Class Diagram

8 Relationships Between Classes 4 An association is a connection between classes 4 A generalization is a relationship between a more general and a more specific element 4 A dependency is a relationship between elements, one independent another dependent 4 A refinement is a relationship between two descriptions of the same thing but at different levels of abstraction

9 Object Diagram

10 The Unified Modelling Language (continued) UNIT 3

11 Unit 3 : Outline 4 Dynamic Modelling –State Diagrams –Sequence Diagrams –Collaboration Diagrams –Activity Diagrams

12 Dynamic Modeling... 4 Describes what happens at run-time –Objects vs Classes 4 How do elements of static diagrams : –Cooperate to manage their tasks –Communicate with each other –Change their state –Provide the functionality of the system 4 Method outline and messages flow 4 For capturing difficult to understand aspects Complements Static Diagrams

13 Dynamic Modeling. 4 Focus on communicating one aspect of a system’s dynamics 4 Model only those elements that are essential 4 Provide detail consistent with the level of abstraction 4 Sometimes a piece of code says more than lines, rectangles,...

14 Different Dynamic Diagrams 4 Sequence Diagrams –Focus on time aspect of interaction and communication 4 Collaboration Diagrams –Focus on space aspect of interaction and communication 4 State Diagrams –Focus on state, behaviour and events 4 Activity Diagrams –Focus on work aspect of interaction and communication Inter-object relation Intra-object relation

15 Unit 3 : Outline 4 Dynamic Modelling –State Diagrams –Sequence Diagrams –Collaboration Diagrams –Activity Diagrams

16 State Diagram Symbols

17 Focus on 4 The possible states of the instances of a class 4 The possible transitions from one state to another one 4 The events firing transitions 4 The operations which are executed within states or during a transition Intra-object relation

18 Purpose of State diagrams 4 To document classes that have : –Clearly identifiable states State = {ongoing_behaviour, attributes,...} –Complex behaviour –Many events (signals)

19 Notation State Diagrams. State State Transition Initial State Final State

20 Parts of a State Diagram Name State Variables Activities State Box State Transition Initial StateFinal State

21 Example State Diagram State Diagram for the Elevator Class On first floor Moving up Idle Moving down Moving to first floor go up(floor) Arrive at floor Arrive at first floor go up(floor) go down(floor) time-out

22 Parts of a State Box Login Login time = Current time Entry/type “login” Exit/login (user name, password) Do/get user name Do/get password Help/display Help State Name State Variables Activity Actions Atomic Can be further decomposed

23 Login Login time = Current time Entry/type “login” Exit/login (user name, password) Do/get user name Do/get password Help/display Help Activities Part of a State Box... 4 Describes the actions undertaken when the object is in a particular state 4 These actions are guided by events Event-name argument-list ‘/’ action-expression

24 Activities Part of a State Box. 4 Standard events : Entry / Action Exit / Action Do / Activity event / Action Action is executed when entering the state Action is executed when leaving the state Activity is executed, parameters are allowed Event is handled within the state

25 State Transition Events… 4 Four kinds of events in UML : Change Event A condition becoming true shown as a guard condition on a state transition Receipt of a message shown as an event signature on state transitions Call Event

26 State Transition Events… Time Event A relative or absolute point in time shown as a time expression on state transition Signal Event Signal Event : The receipt of a signal > out_of_memory keyPressed, …

27 State Transition Events… Messages vs Events modeButton() Display do/display current time Set hours do/display hours Set minutes do/display minutes modeButton() inc/minutes := minutes +1inc/hours := hours +1 DigitalWatch modeButton() inc()

28 State Transition Labels (all optional) event-signature '[' guard-condition ']' '/' action-expression '^' send-clause event-signature = event-name '(' parameter ',',... ')' 4 Examples : –draw(f : Figure, c : Color) –redraw –redraw() –print(invoice)

29 State Transition Labels… event-signature '[' guard-condition ']' '/' action-expression '^' send-clause Guard-condition = A boolean expression placed on a state transition 4 Examples : –[t = 15sec] –[number of invoices > n] –[withdrawal (amount) && balance >= amount ] 4 Guards are mutual exclusive

30 State Transition Labels… event-signature '[' guard-condition ']' '/' action-expression '^' send-clause Action-expression = Is executed when the transition fires 4 Examples : –increase () / n := n + 1 –add (n) / sum := sum + n No nesting or recursion allowed

31 State Transition Labels. event-signature '[' guard-condition ']' '/' action-expression '^' send-clause Send-clause = Explicit syntax for sending a message during a transition between two states 4 Examples : –^ pen.set(color) –[timer = Time-out] ^ self.go down (first floor)

32 Example : Digital Watch modeButton() Display do/display current time Set hours do/display hours Set minutes do/display minutes modeButton() inc/minutes := minutes +1 modulo 60 inc/hours := hours +1 modulo 24

33 Communication between Diagrams OffOn OffOn/StopOn/Play On() Off() On() Stop() Play() On()Off()Stop() Play() Off()/Stop() Stop() Play() CD Player Remote Control

34 Substates… AND-STATES States that may be true at the same time ForwardBackward Running Low speedHigh speed

35 Substates. OR-STATES States that may not be true at the same time ForwardBackward Running

36 Unit 3 : Outline 4 Dynamic Modelling –State Diagrams –Sequence Diagrams –Collaboration Diagrams –Activity Diagrams

37 Sequence diagram Symbols Object 1Object 2Object 3

38 Focus on 4 The interaction and communication between objects 4 Specify the realization of an operation or use case 4 Message sequences 4 Time aspect 4 Cfr Collaboration diagram

39 Two Available Forms 4 Generic form –documents all possible alternatives in a scenario –conditions, loops, branches are possible –cfr class diagram 4 Instance form –documents one possible interaction –no conditions, loops, or branches –cfr object diagram :Computer C1:Computer or C1

40 Different Message Types 4 Only means of communication with objects are messages Synchronous Asynchronous Simple Synchronous with Immediate return

41 Notation Sequence Diagrams… :Computer:PrintServer:Printer Print(ps-file) [no queue] Print(ps-file)

42 Notation Sequence Diagrams. :Computer Print(ps-file) [no queue] Print(ps-file) Object Message send Lifeline Activation Return Guard condition

43 Labels for Iteration C1:CD1:DD2:D message1() message2()send message2 until … message3()

44 Labels for Constraints :Computer:PrintServer:Printer Print(ps-file) a b b’ {b’ – b < 1 sec} {b - a < 5 sec} If PrinterServer receives a file, it should transmit this file to the Printer within 5 sec Communicating the file from the PrinterServer to the Printer should take less than 1 sec

45 Object creation :CustomerWindow :Customer NewCustomer(Data) Customer(Data)

46 Object Destruction :CustomerWindow :Customer RemoveCustomer( ) DeleteCustomer( )

47 Unit 3 : Outline 4 Dynamic Modelling –State Diagrams –Sequence Diagrams –Collaboration Diagrams –Activity Diagrams

48 Collaboration Diagram Symbols

49 Focus on 4 The interaction and communication between objects 4 Shows the static and dynamic relationships between objects – the context aspect 4 Space aspect (time is no dimension on its own) 4 Sequence indicated with numbers

50 Example Collaboration Diagram :PrinterServer [printer free] 1.1:Print(ps-file) :Printer :Computer Print(ps-file) 1:Print(ps-file)

51 Message Flow Labels… predecessor guard-condition sequence-expression return-value predecessor = sequence-number ‘,’ … ‘/’ 4 Indicates the assumed message flow before this message may happen 4 Examples : –1,2,5 / –3 / 4 Only specify if not implicitly available !

52 Message Flow Labels… guard-condition = ‘[‘ condition-clause ‘]’ predecessor guard-condition sequence-expression return-value 4 Examples : –1,2,5 / [t = 15sec] –[number of invoices > n] –[withdrawal (amount) && balance >= amount]

53 Message Flow Labels. predecessor guard-condition sequence-expression return-value sequence-expression = [integer | name][recurrence] ‘:’ recurrence = ‘*’ ‘[‘ iteration-clause ‘]’ recurrence = ‘[‘ condition-clause ‘]’ 4 Indicates that a message is a part of the actions undertaken in response to another message (referred to with the predecessor number) 4 Examples : –1.1 *[x = 1..10]: doSomething() –1 [time-out]: display()

54 Role Names 4 Role Names indicate how the objects know about each other {Global} {Local} {Parameter} {Self} The object is known throughout the entire system The object is known locally (temporary object) The object is known since it was passed as an argument The object is referencing itself {Association} The object is known as an attribute (default)

55 Constraints 4 Constraints indicate the objects’ existence during interaction {New} {Destroyed} {Transient} The object is created during the interaction The object is destroyed during the interaction The object will be created and destroyed Nothing specified The object was available before the interaction took place

56 Example : Role names & Constraints

57 Unit 3 : Outline 4 Dynamic Modelling –State Diagrams –Sequence Diagrams –Collaboration Diagrams –Activity Diagrams

58 Activity Diagram Symbols

59 Focus on 4 Actions and their results 4 How and when actions are taken 4 What actions actually do 4 Where actions take place (swimlanes) 4 Work aspect 4 Flowcharts featuring parallelism

60 Purpose of Activity Diagrams 4 To document : –The actions performed by an operation –The internal working of an object –Make parallelism explicit –A use case How is it performed in terms of actions and states? –Workflow

61 Notation Activity Diagrams. Action/Activity Object Flow Start StateEnd State Control Flow ConcurrencyDecision State

62 Example Activity Diagram Action/Activity Decision Initial event Control Flow (Same label notation as transitions State Diagram) Show MessageBox “Disk full” on screen Show MessageBox “Printing” on screen Remove MessageBox Create Postscript file [disk full] [free disk space] ^Printer.print(file) printFile()

63 Control Flow 4 Indicates the order of actions and activities 4 Represented by transition arrows 4 No events on arrow : –As soon as the execution of the predecessor is finished, the successor is started 4 Guard conditions are allowed

64 Decision State / Concurrency 4 Decision State –Makes alternative sequences explicit –Complex decisions can be visualized by decision trees –Outgoing transitions must have mutually exclusive guards 4 Concurrency –Fork/Join denotes starting/ending point of concurrent execution –Combined with guard conditions it forms an alternative to the decision state

65 Swimlanes Objects that are responsible can be assigned to actions and activities Initiate Measuring Updating Displayer Sampler.Run(channel, frequency) DisplayerSampler

66 Course Overview. 4 UML Diagrams 4 Use-Case diagram 4 Class diagram 4 Object diagram 4 State diagram 4 Sequence diagram 4 Collaboration diagram 4 Activity diagram 4 Component diagram 4 Deployment diagram Last Unit