DOC PREVIEW
GU GCIS 504 - Sequence Diagrams and Collaboration Diagrams

This preview shows page 1-2-15-16-31-32 out of 32 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Sequence Diagrams and Collaboration DiagramsIntroduction/AgendaObject Oriented DesignSequence DiagramSequence Diagram - ObjectsSequence Diagram – Time & MessagesTypes of MessagesSequence Diagram – CompilationBranching Flow: flow goes to different objects [if condition is met]Alternative Flow: flow changes to alternative lifeline branch of the same objectSequence diagram -exampleSystem Design PrinciplesReading from a command file - exampleSequence Diagram – URS Add Subject ScenarioCreating and Deleting objectsCollaboration DiagramsCollaboration DiagramsCollaboration Diagram – URS Add Subject ScenarioSlide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25URS -High Level Class DiagramSlide 27Use Case Vs ScenariosSequence Diagram – Enroll Student for subject successfullyCollaboration Diagram – Enroll Student in Subject ScenarioCollaboration Diagram – Enroll Student in Subject subject - implementationSequence Diagram – Enroll Student for subject - Failure1Sequence Diagramsand Collaboration Diagrams Rajkumar BuyyaGrid Computing and Distributed Systems (GRIDS) LaboratoryDept. of Computer Science and Software EngineeringUniversity of Melbourne, Australiahttp://www.cs.mu.oz.au/~raj or http://www.buyya.com2Introduction/AgendaPieces of UML:Structural DiagramsClass and object diagramComponent and Deployment DiagramBehavioural Diagrams Use Case DiagramActivity DiagramSequence DiagramCollaboration DiagramState Chart DiagramLearned so far: Use case diagram, class and object diagram, class relationshipsToday we will focus on:Sequence DiagramCollaboration Diagram3Object Oriented DesignDesign consists of the following steps :Refine the class diagram.Draw the interaction diagrams for the system.Sequence DiagramCollaboration DiagramIf objects go through complex state transitions – statechart diagramsDo the above steps iteratively as needed.4Sequence DiagramShows how objects communicate with each other over time.That is, sequence diagrams are used to model object interactions arranged in time sequence and to distribute use case behavior to classes.They can also be used to illustrate all the paths a particular use case can ultimately produce.The sequence diagram consists of Active Objects, Messages represented as solid-line arrows, and Time represented as a vertical progression.5Sequence Diagram - ObjectsA life line illustrates what is happening to an object in a chronological fashion.:NameLife lineActivationObject6Sequence Diagram – Time & MessagesMessages are used to illustrate communication between different active objects of a sequence diagram.:Name1 :Name2Message TwoActorMessage One7Types of MessagesSynchronous (flow interrupt until the message has completed.Asynchronous (don’t wait for response)Flat – no distinction between sysn/asyncReturn – control flow has returned to the caller.8Sequence Diagram – Compilation:Compiler LinkerActorCompileFileSystemLoad FilesSave OBJ FilesCompile filesLinkLoad OBJ filesLink OBJ filesWrite EXE file9Branching Flow: flow goes to different objects [if condition is met]:Editor FileSystemLoad File:BinaryViewer :TextViewer[text file][binary file]10Alternative Flow: flow changes to alternative lifeline branch of the same objectEditorActorExit AppFileSystem[delete file][save file]11Sequence diagram -exampleUse case Add Subject Use Case to URS (University Record System):ScenarioScenario 1 : Subject gets added successfully.Scenario 2 : Adding the subject fails because the subject is already in the database.12System Design PrinciplesSystem input can take different forms. E.g.From a graphical user interfaceFrom a command fileURS system should be designed such that the functionality can be re-used.Command reading and functionality implementation have to be separated.13Reading from a command file - exampleclass URS{ public static void main(String[] args){ URSDatabase u = new URSDatabase(); //Read command from file; while ( not end of file) {u.procCommand(cmd);//Read next commad;}//Close file}}14execute()Sequence Diagram – URS Add Subject Scenariou:URSDatabaseprocCmd(cmd)sub1:SubjectSubject(id,name)<< create >>parseCommand(cmd)addSubject(sub1){transient}a:AddSubCmd << create >>[if cmdN = ADDSUB]AddSubCmd(u,cmdA)15Creating and Deleting objectsc:Client:Transactionp: ODBProxysetVales(a,d,3,4)<<destroy>><<create>>committedsetAction(a, d, 0){transient}16Collaboration Diagrams17Collaboration DiagramsClass diagrams indicates what classes are part of our system, what they offer, how they relate, but they don’t tell us how they communicate.Collaboration diagrams show (used to model) how objects interact and their roles.They are very similar to sequence diagrams. Actually they are considered as a cross between class and sequence diagram.Sequence Diagrams are arranged according to Time.Collaboration Diagrams represent the structural organization of object.[Both sequence and collaboration diagrams are called interaction diagrams]18Collaboration Diagram – URS Add Subject Scenariou:URSDatabase<<self>>a:AddSubCmd 2:[if cmdN = ADDSUB]AddSubCmd(u,cmdA) <<local>>{new}{transient}3: execute()3.2: addSubject(sub1)1:parseCommand(cmd)procCmd(cmd)sub1:Subject 3.1: Subject(id,name){new}19Collaboration Diagram – URS Add Subject Scenariou:URSDatabase<<self>>1:parseCommand(cmd)procCommand(cmd)class URSDatabase{ private String cmdN; private String cmdA; private parseCommand(String cmd){ cmdN = …. cmdA = …. } public procCommand(String cmd){ parseCommand(cmd); }}20Collaboration Diagram – URS Add Subject Scenariou:URSDatabasea:AddSubCmd 2: AddSubCmd(u,cmdA){new}{transient}class URSDatabase{ private String cmdN; private String cmdA; public procCommand(String cmd){ parseCommand(cmd); if (cmdN == ADDSUB){ AddSubCmd a = new AddSubCmd(u,cmdA); } }}21Collaboration Diagram – URS Add Subject Scenarioclass abstract Command { protected String cmd; protected URSDatabase u; public abstract void execute();} class AddSubCmd extends Command{ public AddSubCmd(URSDatabase urs, String cmd){ u = urs; // parse command and set the arguments } public void execute(){ // implement here }}22Collaboration Diagram – URS Add Subject Scenariou:URSDatabasea:AddSubCmd<<local>>3: execute()class URSDatabase{ private String cmd; public


View Full Document

GU GCIS 504 - Sequence Diagrams and Collaboration Diagrams

Download Sequence Diagrams and Collaboration Diagrams
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Sequence Diagrams and Collaboration Diagrams and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Sequence Diagrams and Collaboration Diagrams 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?