Presentation is loading. Please wait.

Presentation is loading. Please wait.

1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch

Similar presentations


Presentation on theme: "1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch"— Presentation transcript:

1 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch http://www.technion.ac.il/~erant Spring 2007

2 2 Outline Introduction Basic notation Alternating paths Modularity

3 3 Modeling Process Introduction | Basics | Alternations | Modularity PhaseActionsOutcome Initiation Raising a business need Business documents Requirements Interviewing stakeholders, exploring the system environment Organized documentation Specification Analyze the engineering aspect of the system, building system concepts Formal specification Design Define architecture, components, data types, algorithms Formal Specification Implementation Program, build, unit-testing, integrate, documentation Testable system Testing & Integration Integrate all components, verification, validation, installation, guidance Testing results, Working sys Maintenance Bug fixes, modifications, adaptation System versions

4 4 Why to Model Behavior? How do we use the SMS Server interface? What is the order of executing the operations? –sendMessage, getStatus, Resend? –getStatus, sendMessage, checkForMessages? When do we use resend? Introduction | Basics | Alternations | Modularity

5 5 Behavioral Modeling Where are people coming from? Where are they going? How do they move from one space to the other? Introduction | Basics | Alternations | Modularity

6 6 Behavior Modeling In process supplied Order Checkout Manager Order message: change status Add to cart Check availability Supply Order Notify User [okay] [problem] Sequence DiagramsActivity DiagramsState Diagrams Introduction | Basics | Alternations | Modularity * We will not talk about collaboration diagrams Inventory message: create

7 7 Outline Introduction Basic elements Alternating paths Modularity

8 8 Building a Sequence Diagrams Class A Class C Class B Class D Use Case 1 Use Case 2 Use Case 3 Sequence diagrams capture the use-case behavior using the foundation of the classes. therefore Sequence = Objects + messages Introduction | Basics | Alternations | Modularity

9 9 Sequence Diagrams p : Product : ShooppingCart addProduct (p) customer display() getPrice() checkout () sd Product Buying objects message Life line activation (focus of control) Diagram Name A simple sequence diagram: Introduction | Basics | Alternations | Modularity

10 10 Object Control obj1 : Class1 obj2 : Class2 do (…) : Class3 create (…) obj1 : Class1 user operate() Object Creation Object Destruction Return Message foo() Messages to self Introduction | Basics | Alternations | Modularity Illustration

11 11 Illustration Corresponding Class Diagram Notice that a dependency exists whenever messages are passed between instances of the class Dependencies can be overridden by associations, aggregations etc. Introduction | Basics | Alternations | Modularity

12 12 Sequences and Use-Cases p : Product : ShooppingCart addProduct (p) : Order create (…) customer display() getPrice() checkout () Introduction | Basics | Alternations | Modularity Hidden part Visible part

13 13

14 14 Full Message Attributes C3.1: res := getLocation (fig) sequence number return value message nameargument list [sequence-expression] [return-value :=] [message-name] [(argument-list)] Introduction | Basics | Alternations | Modularity

15 15 Different Kinds of Messages Synchronous Message asynchronous Message Return Message Introduction | Basics | Alternations | Modularity

16 16 Synchronous & Asynchronous Messages teller: Order: Article Nested Flow getValue price setID applerr handlalarm Asynchronous Flow unknown ring Price need to be finished, before teller can do another operation (getName) Ring is executed, while the control flow is returned to err handle and appl unknown log Introduction | Basics | Alternations | Modularity Example

17 17 Outline Introduction Basic elements Alternating paths Modularity

18 18 Flow Constructs When we tell a scenario, which types of alternatives do we need? Introduction | Basics | Alternations | Modularity If Else Loop Repeat Jump

19 19 Example Options archive(msg) msg : Message: Database opt Do something... [msg.status=confirmed] Fragment Condition Introduction | Basics | Alternations | Modularity Used for modeling simple optional blocks. Has one operand; no "else" guard.

20 20 Alternatives archive(msg) msg : Message: Database Condition : Admin alt notify(msg.getID()) wait() [msg.status=confirmed] [msg.status=error] [else] Else condition (optional) Alternative Fragment group Execution regions. At most one will execute. Introduction | Basics | Alternations | Modularity

21 21 Loops Display() : OS: Folder : File loop Display() [for each Folder] [for each File] Loop Fragment Condition Nested Loop Fragment Introduction | Basics | Alternations | Modularity

22 22 Breaks isLooged = login(name,pass) : User: User Manager : Policy addBadLogin(name) break [ ¬ isLooged] Do something… If the condition is met, the break fragment is executed, and the reminder of the sequence is ignored Handy in model exception handling Introduction | Basics | Alternations | Modularity

23 23 Examples of Guards [for each Object] [5] [i=1..5] [status = okay] No guard means an infinite loop Introduction | Basics | Alternations | Modularity

24 24 Outline Introduction Basic elements Alternating paths Modularity

25 25 Modularity We need ways to create modular scenarios Introduction | Basics | Alternations | Modularity

26 26 Referencing a diagram login(name,pass) : User: User Manager : Policy Login Handling(user,pass) : bool ref Do something… Reference Gate Introduction | Basics | Alternations | Modularity

27 27 Referenced Diagram : User Manager: UserAccount sd Login Handling loop cName -= getUseNamer() [for each UserAccount] login(name,pass) opt [cName = name] cName -= getUseNamer() isInSystem(true) true false Diagram name Input message Output message Introduction | Basics | Alternations | Modularity

28 28 Parallel Fragments provideDetails(…) : User : Checkout Handler : Shipping Handler performCheckout() : Transaction Handler par Ship(address,products) provideDetails(…) chargeMoney(CC,sum) Introduction | Basics | Alternations | Modularity

29 29 Critical Fragment the region is treated atomically by the enclosing fragment (i.e. parallel fragment) No other operations can interfere while a critical region is executed Introduction | Basics | Alternations | Modularity

30 30 Summary Behavior Modeling Sequence models interaction Language Objects + lifeline Messages Alternations Loops Alternatives Modularity Referencing Parallel Introduction | Basics | Alternations | Modularity


Download ppt "1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch"

Similar presentations


Ads by Google