Shanghai Jiao Tong University 上海交通大学 Object Oriented Analysis and Design Interaction Diagrams 上海交通大学软件工程中心
Shanghai Jiao Tong University 上海交通大学软件工程中心 Object Oriented Analysis and Design Interaction Diagrams
Outline ★◆Classes ◆ Interaction diagrams ◆ Sequence diagrams ◆( Collaboration diagrams ◆ Interaction diagram comparison ◆Reports Object Oriented Analysis and Design 2
Object Oriented Analysis and Design 2 Classes Interaction diagrams Sequence diagrams Collaboration diagrams Interaction diagram comparison Reports Outline
What Are Classes? A class is a set of objects that share the same attributes,operations,relationships, and semantics. In the UML,a class is represented by a compartmentalized rectangle. BuyerRecord (from Analysis Model) 色name:String address String ◆find buyer record ●create a new record0 get e-mail address0 Object Oriented Analysis and Design 3
Object Oriented Analysis and Design 3 What Are Classes? A class is a set of objects that share the same attributes, operations, relationships, and semantics. In the UML, a class is represented by a compartmentalized rectangle
Attributes An attribute defines the characteristics or structure of a class. In the UML,a class attribute is displayed in the middle of the compartmentalized rectangle. BuyerRecord (from Analysis Model) Attribute name:String address:String ◆find buyer recordO create a new record( get e-mail address0 Object Oriented Analysis and Design 4
Object Oriented Analysis and Design 4 Attributes An attribute defines the characteristics or structure of a class. In the UML, a class attribute is displayed in the middle of the compartmentalized rectangle. Attribute
Operations An operation is the service provided by the class.It is the behavior of the class. In the UML,a class operation is displayed in the bottom of the compartmentalized rectangle. BuyerRecord BuyerRecord (from Analysis Model) (from Analysis Model) name:String 念name:String 急address:String ®address:String Operations find buyer recordO ◆find buyer record Responsibilities ●create a new recordo ◆create a new record get e-mail address0 get e-mail address0 Object Oriented Analysis and Design 5
Object Oriented Analysis and Design 5 Operations An operation is the service provided by the class. It is the behavior of the class. In the UML, a class operation is displayed in the bottom of the compartmentalized rectangle. Operations Responsibilities
How Are Classes Found? Classes can be discovered using various artifacts. Use-Case BuyerRecord PersonalPlannerForm Specification Stakeholder Requests (from Analysis Model) (from Analysis Model) Classes Glossary Object Oriented Analysis and Design 6
Object Oriented Analysis and Design 6 How Are Classes Found? Classes can be discovered using various artifacts. Use-Case Specification Glossary Stakeholder Requests Classes
Outline ◆Classes Interaction diagrams Sequence diagrams ◆ Collaboration diagrams ◆ Interaction diagram comparison ◆Reports Object Oriented Analysis and Design 7
Object Oriented Analysis and Design 7 Classes Interaction diagrams Sequence diagrams Collaboration diagrams Interaction diagram comparison Reports Outline
Objects Need to Collaborate ◆ Objects are useless unless they can collaborate to solve a problem. Each object is responsible for its own behavior and status. No one object can carry out every responsibility on its own. How do objects interact with each other? They interact through messages. Object Oriented Analysis and Design 8
Object Oriented Analysis and Design 8 Objects Need to Collaborate Objects are useless unless they can collaborate to solve a problem. ▪ Each object is responsible for its own behavior and status. ▪ No one object can carry out every responsibility on its own. How do objects interact with each other? ▪ They interact through messages
Objects Interact with Messages A message shows how one object asks another object to perform an operation. Message getCourseOfferings(forSemester) RegistrationController :CourseCatalogSystem Object Oriented Analysis and Design 9
Object Oriented Analysis and Design 9 Objects Interact with Messages A message shows how one object asks another object to perform an operation. : Car buyer Message :RegistrationController :CourseCatalogSystem getCourseOfferings(forSemester)
What Is an Interaction Diagram? An interaction diagram models the dynamic aspects of the system by showing relationships among objects and the messages they may dispatch. There are two types of interaction diagrams Sequence 吴 Collaboration Sequence Diagram Collaboration Diagram Object Oriented Analysis and Design 10
Object Oriented Analysis and Design 10 What Is an Interaction Diagram? An interaction diagram models the dynamic aspects of the system by showing relationships among objects and the messages they may dispatch. There are two types of interaction diagrams. ▪Sequence ▪ Collaboration Collaboration Diagram Sequence Diagram