Software Engineering I Nov. 1, 2013 Notes Interaction and sequence diagrams 1. Sequence Diagrams - Covered using previous notes 2. Communication Diagrams - Shows several objects working together - Similar to an object diagram, but shows communication as links instead of associations - Similar to sequence diagram, too +--------------+ 1: Create +-------------+ 2:addToSchedule +---------+ |:CourseSection| ---------> |:Registration| --------------> |:Student | |--------------|------------|-------------|-----------------|-------- | +--------------+ <-------- +-------------+ +---------+ 3: addToRegistrationList Communication Links - Exist between two objects whenever it is possible to send a message from one to the other Made possible: - By associations - Also by receiving object stored in a local variable of the sending method which is tagged with the local object - Also if a reference to the receiving object has been received as a parameter of an earlier message to the senter (tagged with <>) - Or if the receiving object is global (tagged with <>) - Or when objects communicate over a network (<>) Use sequence diagrams when: - Reader needs to see the order in which messages occur - Building an interaction model for a use case and you need to decide which steps to show - Showing details of messages - Need to show loops, optional sequences, etc. Use communication diagrams when: - You are deriving interaction diagrams from a class diagram Do so because - They are the same as the object diagram, except they include communication links - They help to validate the class diagram State diagrams - Used to express dynamic information about a system - We try to start only one state diagram in each top level diagram - Starting state is represented by a black dot (a * these text diagrams) - Ending state is represented by a black dot enclosed in a circle ( a (*) in these text diagrams) Example: Tic Tac Toe +----------+ * ---> | X Turn |-----------> (*) X Wins +----------+------+ | ^ | | | +----> (*) Tie V | | +----------+------+ | O Turn |------------>(*) O Wins +----------+ - Transitions may be named to indicate how they occur