More http perisic comoosd Object Oriented Software Development
More: http: //perisic. com/oosd Object Oriented Software Development (Recycling Machine) n Marc Conrad n n D 104 (Park Square Building) Marc. Conrad@beds. ac. uk http: //perisic. com/marc These slides: n Sequence Diagrams 30/11/2020 16: 33: 37 Marc Conrad http: //perisic. com/marc 1
Interaction Diagrams n n More: http: //perisic. com/oosd The UML includes interaction diagrams to illustrate how objects interact via messages to fulfil tasks. A sequence diagram is a kind of an interaction diagram The next slides discuss mostly the syntax and semantics of sequence diagrams. Later topic: Strategies for good design (patterns). 30/11/2020 16: 33: 42 Marc Conrad http: //perisic. com/marc 2
More: http: //perisic. com/oosd Interaction Diagrams - when? n n Identify the system events that are implied by the use cases. Make at least one interaction diagram for each system event. Make additional interaction diagrams for alternative courses of events. Example (Recycling machine, use case “enter item”): n System events: enter item, print receipt. n Enter item has two alternative courses: n Enter first item n Enter next items n Therefore three interaction diagrams for the “enter item” use case. Marc Conrad 30/11/2020 16: 33: 47 http: //perisic. com/marc 3
More: http: //perisic. com/oosd Sequence Diagram: Insert first item. 30/11/2020 16: 33: 50 Marc Conrad http: //perisic. com/marc 4
More: http: //perisic. com/oosd Sequence Diagram: Insert first item. Flow of messages 1: item. Received() 2: classify. Item(Integer) 3: create Receipt. Basis() 4: create() 5: add. Item(Deposit Item) 30/11/2020 16: 33: 55 Marc Conrad http: //perisic. com/marc 5
More: http: //perisic. com/oosd Sequence Diagram: Insert next items. 30/11/2020 16: 34: 00 Marc Conrad http: //perisic. com/marc 6
More: http: //perisic. com/oosd Sequence Diagram: Print receipt. 30/11/2020 16: 34: 04 Marc Conrad http: //perisic. com/marc 7
More: http: //perisic. com/oosd Syntax - classes and objects n The following notation is used in the UML for classes and objects: Person n Class: Instance of a Class : Person (object without a name): n Named instance of a class fabian: Person (named object): n Named object only fabian Marc Conrad (shown without class): 30/11/2020 16: 34: 09 http: //perisic. com/marc n 8
More: http: //perisic. com/oosd Sequence Diagram: Objects n n A sequence diagram usually shows relations between objects. The name of the classes comes from the name of the concepts in the conceptual model. The objects are arranged on the top. When the course of events is initiated by an actor the actor symbol is displayed as the leftmost object. 30/11/2020 16: 34: 16 Marc Conrad http: //perisic. com/marc 9
More: http: //perisic. com/oosd Sequence Diagram: Lifelines : actor : object 1 : object 2 : object 3 Time n n 30/11/2020 16: 34: 18 Each object has a lifeline. Time flows from top to down. Marc Conrad http: //perisic. com/marc 10
More: http: //perisic. com/oosd Sequence Diagram: Rectangles. : actor : object 1 Time n n 30/11/2020 16: 34: 24 : object 2 : object 3 Rectangles refer to events that are related to each other. They are drawn automatically by Rational Rose. Marc Conrad http: //perisic. com/marc 11
More: http: //perisic. com/oosd Sequence Diagram: Messages. : actor : object 1 Time n 30/11/2020 16: 34: 31 : object 2 : object 3 Arrows show messages that are send from one object to another. Marc Conrad http: //perisic. com/marc 12
More: http: //perisic. com/oosd Sequence Diagram: Message to self n An object sends a message to itself. 30/11/2020 16: 34: 36 Marc Conrad http: //perisic. com/marc 13
More: http: //perisic. com/oosd Sequence Diagram: Creation of Objects n The Deposit Item Receiver object creates the Receipt Basis object. Marc Conrad 30/11/2020 16: 34: 39 http: //perisic. com/marc 14
Other Syntax Elements n n More: http: //perisic. com/oosd A note clarifies the course of events. A feedback arrow shows that a message returns a value. A X at the end of a lifeline shows that the Marc Conrad object ceases to exist. 30/11/2020 16: 34: 42 http: //perisic. com/marc n 15
- Slides: 15