Tham khảo tài liệu 'bài giảng phân tích thiết kế hướng đối tượng (phần 5)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Use case realization Lecture 5 Hoa Sen University Agenda Notations Dependency Interaction and Class diagrams Hoa Sen University Interaction diagrams Generalization of two more specialized UML diagram types Sequence diagrams Communication diagrams Illustrate how objects collaborate via messages and methods Hoa Sen University Sequence vs. Communication diagram Sequence diagrams illustrate interactions in a kind of fence format Easier to see the call sequence Large set of detailed notation options Communication diagrams illustrate interactions in a graph or network format More space-efficient Hoa Sen University Common notation: participants – lifeline box Hoa Sen University Sequence diagram notation Lifeline boxes and lifelines Messages Synchronous message Found message Focus of control and execution specification bars Hoa Sen University Sequence diagram notation Illustrating reply or returns Using the message syntax returnVar = message(parameter). Using a reply . | Use case realization Lecture 5 Hoa Sen University Agenda Notations Dependency Interaction and Class diagrams Hoa Sen University Interaction diagrams Generalization of two more specialized UML diagram types Sequence diagrams Communication diagrams Illustrate how objects collaborate via messages and methods Hoa Sen University Sequence vs. Communication diagram Sequence diagrams illustrate interactions in a kind of fence format Easier to see the call sequence Large set of detailed notation options Communication diagrams illustrate interactions in a graph or network format More space-efficient Hoa Sen University Common notation: participants – lifeline box Hoa Sen University Sequence diagram notation Lifeline boxes and lifelines Messages Synchronous message Found message Focus of control and execution specification bars Hoa Sen University Sequence diagram notation Illustrating reply or returns Using the message syntax returnVar = message(parameter). Using a reply message line Message to “self” or “this” public class Register{ public void doX(){ clear(); } public void clear(){ } } Hoa Sen University Sequence diagram notation Creation of instance In implementation: invoke the new operator and call the constructor Object lifelines and object destruction In language that does not have garbage collection Hoa Sen University Sequence diagram notation Diagram frames in UML sequence diagrams Support conditional and looping construct Hoa Sen University Sequence diagram notation Common frame operators Hoa Sen University Frame operator Meaning Alt Alternative fragment for mutual exclusion conditional logic expressed in the guards Loop Loop fragment while guard is true Opt Optional fragment that executes if guard is true Par Parallel fragments that execute in parallel Region Critical region within which only one thread can run Sequence diagram notation Conditional messages public class foo{ Bar bar = new Bar(); public void m1(){ .