today s lecture inf 111 cse 121
play

Todays Lecture INF 111 / CSE 121: UML Software Tools and Methods - PDF document

Todays Lecture INF 111 / CSE 121: UML Software Tools and Methods Package Diagrams State Transition Diagrams Activity Diagrams y g Communication Diagrams Lecture Notes for Summer Quarter, 2008 Michele Rousseau Set 8


  1. Today’s Lecture INF 111 / CSE 121: � UML Software Tools and Methods ● Package Diagrams ● State Transition Diagrams ● Activity Diagrams y g ● Communication Diagrams Lecture Notes for Summer Quarter, 2008 Michele Rousseau Set 8 – UML – Part 2 4 Lecture Notes 8 - UML Announcements Package Diagrams � UML Links: � What is a package ? � http://dn.codegear.com/article/31863#us ● A construct that enables you to organize model elements into groups e-case-diagram ● Classes or use cases � A package diagram is a diagram with � A package diagram is a diagram with packages and their dependencies 2 5 Lecture Notes 8 - UML Lecture Notes 8 - UML Previously in INF 111/CSE121… Why use package diagrams? � UML � Increases the level of abstraction for ● Class Diagrams complex diagrams ● Use Case Diagrams ● Sequence Diagrams � Depict a high-level overview of your requirements or architecture/design ● A collection of use case or class diagrams � To logically modularize a complex diagram � To logically modularize a complex diagram � To organize Java source code Not limited to class and use case diagrams Because diagrams can get messy 3 6 Lecture Notes 8 - UML Lecture Notes 8 - UML 1

  2. Package Diagrams: Notation Class Diagram Example � Represented as tabbed folders � Can use visibility markers + Public - Private # Protected 7 10 Lecture Notes 8 - UML Lecture Notes 8 - UML Relationships Some Basic Tips on Packages Two Types � Use Simple, Descriptive Names � Dependencies ● Changes to one package � Use when you need to Simplify affects another Diagrams ● Import is one type that � Packages Should be Cohesive grants access ● Represented by a dashed � Avoid Cyclic Dependencies Between arrow Packages � Generalizations ● Represented with an open arrow just like in previously discussed diagrams 8 11 Lecture Notes 8 - UML Lecture Notes 8 - UML Use Case Example Types of UML Diagrams Structure . Behavior . (4 types) (6 types) � Activity diagram � Class diagrams � Use Case diagram � Object diagram � State machine diagram � Package diagram g g � Interaction diagrams � Interaction diagrams � Composite structure ● Sequence diagram diagram ● Communication diagram ● Interaction overview � Component diagram diagram � Deployment Diagram ● Timing diagram If the appropriate diagram is not part of UML use it anyways 9 12 Lecture Notes 8 - UML Lecture Notes 8 - UML 2

  3. State Transition Diagrams State Transition EX: Digital Watch � State Transition Diagrams show the dynamic behavior of a class instance or of a whole system � State : the duration of time during which an object is doing an activity. � A state diagram is a graph in which � A state diagram is a graph in which ● nodes correspond to states and ● directed arcs correspond to transitions ● labeled with event names . When to use : Necessary for those objects whose behavior across many use cases needs to be understood 13 16 Lecture Notes 8 - UML Lecture Notes 8 - UML State Transition Diagrams Actions A short software process that executes immediately. � � An event occurs at a point in time and � A transition may trigger an action. � May be triggered on entry or exit of states (instead of labeling ● transmits information from one object to another each incoming (entry) and outgoing (exit) transition with these actions). � An action occurs in response to an event and � An event may trigger an action without leaving the state, cannot be interrupted ● i.e., without triggering exit and entry actions as a self-transition would do. � An activity is an operation with certain ty s a ope at o t ce ta act � An action may trigger events, usually in other objects. A ti t i t ll i th bj t duration that can be interrupted by another � Actions may take arguments . event � A guard is a logical condition placed before a transition that returns either a true or a false. 14 Lecture Notes 8 - 17 Lecture Notes 8 - UML State Transition Diagrams: Activities Notation � Can take “longer”, ● i.e., they are processes which last as long as an object is in State Name a certain state . � Are interruptible , � State symbol: Do/Activity ● i.e., an event causing a state transition may abort an Entry/Action activity. Exit/Action Exit/Action � May be constructed from a start and a final action. Event [Guard] / Action � Transition Symbol: 15 18 Lecture Notes 8 - UML Lecture Notes 8 - UML 3

  4. Activity Activity Diagrams Diagram: ATM Ex. � Describe ● Procedural logic ● Business process ● Workflow � A flow chart with support for parallel behavior � Branches and Merges model the conditional behavior b h i � Branch: has a single incoming transition multiple, conditional, outgoing transitions � Merge: where conditional behavior terminates Each branch has a corresponding merge � Represented as a Diamond 19 22 Lecture Notes 8 - UML Lecture Notes 8 - UML Activity Diagram (2) Conditional Thread � Forks and Joins model parallel behavior There are some exceptions to the each fork having a corresponding join: � Fork: has a single incoming transition and multiple outgoing transitions (exhibiting parallel behavior) � Conditional Thread: A condition on � Join: synchronizes the parallel behavior y p the thread originating from the fork ● All parallel behaviors complete at the join to create an exception for the join � Represented as a thick line rule. ● If the condition is false then that condition Each Fork has generally has a corresponding is considered to be complete Join 20 23 Lecture Notes 8 - UML Lecture Notes 8 - UML Activity Conditional Thread: Example Diagram: Order Ex. 21 24 Lecture Notes 8 - UML Lecture Notes 8 - UML 4

  5. Superstates Swimlanes � What if you need to decompose your activity diagram? � Superstates ● You can show the superstate with the internal behavior inside or internal behavior inside or ● You can show these in a parent diagram ● You can also use explicit initial and final states Adv: you can decouple the parent from the subsidiary and use it in other contexts 25 28 Lecture Notes 8 - UML Lecture Notes 8 - UML Atm Ex. Activity Diagram: Superstate 26 29 Lecture Notes 8 - UML Lecture Notes 8 - UML Partitioning an Activity Diagram When do you use Activity Diagrams? Activity diagrams tell you what is � Modeling parallel behavior happening, but how do you know who � Analyzing a use case does what? ● Trying to understand what actions need to take place (in programming – which class is ● Determine behavioral dependencies responsible for each activity) � Swimlanes: group related activities into � Understanding workflow ● Documenting the logic of a business process one column (usually organizationally) ● You must arrange your diagram into vertical zones � Describing a complicated sequential separated by lines. algorithm ● Can be difficult with complex diagrams � Dealing with multi-threaded applications ◘ In this case use non-linear zones – better than nothing 27 30 Lecture Notes 8 - UML Lecture Notes 8 - UML 5

  6. Not so good for From Use Cases to Code � Trying to see how objects collaborate ● Use an interaction diagram for that � Trying to see how an object behaves Select a Perform Perform over its lifetime it lif ti use case Use Case Use Case Write Code (or scenario) Analysis Design ● Use a state diagram for that 31 34 Lecture Notes 8 - UML Lecture Notes 8 - UML Communication Diagrams Use Case Analysis � Used to be known as Collaboration Diagrams For each use case in an iteration… (UML 1.x) – but modified for 2.0 Create a use case realization � Show interactions between run-time elements 1. � Similar to sequence diagrams, but Supplement the Use-Case 2. ● Focus on objects roles & structure descriptions ● Sequence diagram is better at visualizing processing over time time ◘ if necessary It is an object diagram that shows message passing relationships Find Analysis Classes from Use- 3. Emphasis on the flow of messages among objects, Case Behavior rather than timing and ordering of messages Distribute Behavior to Analysis � Sequence Numbers are on arrows rather than 4. vertical order Classes 32 35 Lecture Notes 8 - UML Lecture Notes 8 - UML 1. Use-Case Realization Communication Diagrams: Ex A use-case realization is a collection of UML diagrams which together validate that we have ● the classes � Class Diagrams (static relationships) ● responsibilities ● object interactions � Interaction Diagrams (dynamic relationships) – could be Sequence or Collaboration necessary to provide the behavior in our use case process. 33 36 Lecture Notes 8 - UML Lecture Notes 8 - UML 6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend