Omg Fundamental Certification 4


Published on

Published in: Technology, Health & Medicine
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Omg Fundamental Certification 4

  1. 1. UML 2-OMG certification course (OCUP Fundamental-3) Instructor: M.C. Ricardo Quintero
  2. 2. Dependencies <ul><li>Def.- A dependency is a relationship between one (or several) source elements and one (or several) target elements. </li></ul><ul><li>The target elements are required for the specification or implementation of the source elements. </li></ul><ul><li>The source elements are incomplete without the target elements. </li></ul>
  3. 3. Notation & Semantics <ul><li>A dependency is represented by a dashed arrow , where the arrow points from the dependent element to the independent element. </li></ul>dependent independent dependent independent1 independent1
  4. 4. The metamodel for dependencies
  5. 5. Notation & Semantics <ul><li>The type of dependency can be specified by using a keyword or stereotype . </li></ul>
  6. 6. Causes of Dependencies <ul><li>A package depends on another package. </li></ul><ul><li>A class uses a specific interface to another class. If the interface is changed, then changes are also required in the class that uses this interface. </li></ul><ul><li>An operation depends on a class. (e.g. The class is used in an operation parameter). </li></ul>
  7. 7. Types of dependency relationships <ul><li>Abstraction relationship : dependency relationship between model elements at various abstraction levels. Used with a stereotype. Default stereotypes: <<derive>>, <<trace>> and <<refine>>. </li></ul><ul><li>An abstraction relationship always has a mapping rule , specifying how the participating elements relate to one another (formal o informal). </li></ul><ul><li>The relationship can also be bidirectional, depending on the stereotype and mapping rule. </li></ul><ul><li>A special abstraction relationship is realization , a relationship between an implementation an its specification element. </li></ul>
  8. 8. Types of dependency relationships <ul><li>A substitution relationship specifies that instances of the independent element can be substituted by instances of the dependent element at runtime. (e.g. When the elements implement the same interfaces). </li></ul>List Sortable list <<substitute>>
  9. 9. Types of dependency relationships <ul><li>A usage relationship is a special dependency relationship limited to the implementation and it doesn’t apply to specification. This means that the dependent element requires the independent element for its implementation. </li></ul><ul><li>More specifically, there can be no usage relationship between interfaces but ther can be a dependency relationship </li></ul>List Order <<use>>
  10. 10. Types of dependency relationships <ul><li>A permission relationship is a special dependency relationship that allows the dependent element to access the independent element. </li></ul><ul><li>In the example Boss obtains the right to access the class Employee (including the private attribute salary ). </li></ul>Employee +name -salary Boss <<permit>>
  11. 11. Types of dependency relationships <ul><li>An example using the dependency relationship: a design class and its optimized implemention. A text comment is often very helpful. </li></ul>Tariffing Boss <<derive>> Optimized performance (i.e. The calculation now uses locally replicated data)
  12. 12. Types of dependency relationship Keyword for permission relationship The dependent element is permitted to use private of this independent element <<permit>> Stereotype to usage relationship The dependent element creates instances of the independent element. Is defined between classifiers. <<instantiate>> Stereotype to abstraction relationship The dependent element is derived from the independent element <<derive>> Stereotype to usage relationship The dependent element creates instances of the independent element. Is delined between classifiers <<Create>> Stereotype to usage relationship Is defined and specified from one operation to another operation, so that the source operation calls the target operation. The source can also be a class (the class contains an operation that calls the target operation) <<call>> Description Keyword/Stereotype
  13. 13. Types of dependency relationship Keyword fo usage relationship The dependent element uses the independent element for its implementation <<use>> Stereotype to abstraction relationship The dependent element leads to the independent to trace semantic dependencies (e.g. From a use case to a class) <<trace>> Steretotype to abstracton relationship The dependent element resides on a more concrete semantic level than the independent element <<refine>> Description Keyword/Stereotype
  14. 14. Checklist: dependency relationships <ul><li>In what context is the term “incomplete” used for a dependency relationship? </li></ul><ul><li>In which direction does the arrow point that indicates the relationship between dependent and independent elements? </li></ul><ul><li>What is an abstraction relationship? </li></ul><ul><li>What is a realization relationship? </li></ul><ul><li>What is a substitution relationship? </li></ul><ul><li>What is a usage relationship? </li></ul><ul><li>What is a permission relationship? </li></ul>
  15. 15. Interfaces <ul><li>Def.- Interfaces are special classifiers that use a set of features to specify a selected part of the externally visible behavior of model elements (mainly classes and components). </li></ul><ul><li>An implementation (or InterfaceRealization ) relationship is a special realization relationship between a classifier and an interface. </li></ul><ul><li>The classifier implements the features specified in the interface. </li></ul>
  16. 16. The metamodel for interfaces
  17. 17. Notation & Semantics <ul><li>Interfaces are denoted the way that classifiers are denoted except that they carry the keyword <<interface>> . </li></ul><ul><li>A supplied interface is provided by a model element for use by another element. </li></ul><ul><li>A required interface is an interface requested by another model element. </li></ul>
  18. 18. Notation & Semantics <ul><li>Intefaces specify not only operations , but also attributes . </li></ul><ul><li>Accodingly its metamodel, interfaces can have associations to other interfaces or classes . </li></ul><ul><li>If a classifier wants to implement an interface, it has to implement all operations defined in that interface. </li></ul>
  19. 19. Notation & Semantics <ul><li>If the interface has attribute, the classifier has to behave as if it owned these attributes . </li></ul><ul><li>In the simplest case, it actually implements the attributes. </li></ul><ul><li>However, it is also sufficient to supply just the pertaining get() and set() methods. </li></ul>
  20. 20. Notation & Semantics <ul><li>A classifier can implement several interfaces and also contain other properties. </li></ul><ul><li>In other words, an interface generally describes a subset of a classifier’s operations and attributes . </li></ul>
  21. 21. Supplied Interface (arrow notation & plug notation) Opel Astra implements the interface Car. Opel Astra provides the Car interface Provider Provider <<interface>> Interface-A Interface-A
  22. 22. Required Interface (arrow notation & plug notation) For a required interface, the requiring element has a usage relationship with the interface User <<interface>> Interface-A RacingDriver Car User Interface-A <<use>>
  23. 23. Example extending and implementing interfaces RacingDriver Car Manager LuxuryCar
  24. 24. Checklist: Interfaces <ul><li>What specifies an interfaces? </li></ul><ul><li>What do you call the relationship between an implementing classifier and an interface? </li></ul><ul><li>What is a ball-socket notation? </li></ul>
  25. 25. Behavior basics <ul><li>We are going to discuss the representation and description of general behavior in UML. </li></ul><ul><li>Behavior basics refers to the package CommonBehaviors::BasicBehaviors in the UML 2.0 specification. </li></ul><ul><li>It constitutes 10 percent of the test. </li></ul>
  26. 26. Introduction <ul><li>The process of modeling involves a description of flows, time dependency, state changes, the processing of events and similar things. </li></ul><ul><li>UML is object-oriented, which means that behevior is nothing that exists independently, but always concerns specific objects . </li></ul><ul><li>The responsability for a behavior can always be put down in detail to an object. </li></ul>
  27. 27. Introduction <ul><li>The description of behavior refers to the behavior of a classifier . </li></ul><ul><li>Four descriptions are available: </li></ul><ul><ul><li>State and protocol automatons (state machines). </li></ul></ul><ul><ul><li>Activities and actions. </li></ul></ul><ul><ul><li>Interactions. </li></ul></ul><ul><ul><li>Use cases. </li></ul></ul>
  28. 28. Packages for dynamic modeling in the metamodel Behavioral descriptions
  29. 29. Introduction <ul><li>The package CommonBehaviors defines the fundamental concepts used to describe behavior and corresponding relations with structural elements . </li></ul><ul><li>Every behavior results from actions of at least one object and causes the participating objects to change their states . </li></ul>
  30. 30. Two forms of behavior <ul><li>Executing behavior: is directly connected to an object that processes this behavior ( host ) and to another object that caused this behavior ( invoker ). </li></ul><ul><li>The execution of this behavior is triggered by calling a behavioral feature of an object , where this call is made by another object or an event or by creating a new object . </li></ul>
  31. 31. Two forms of behavior <ul><li>Emergent behavior : refers to the interactions among different participating objects . It is an abstraction and summary of the behavior of several single objects or a set of objects. </li></ul><ul><li>This form of behavior doesn’t give a clue as to which object trigger or process what . </li></ul>
  32. 32. The metamodel for basic behavior
  33. 33. The basic behavior metamodel <ul><li>Behavior can be defined directly and independently as a class. </li></ul><ul><li>Behavior is specialization of Class . Behavioral description can be defined within another classifier ( BehavioredClassifier ) that owns this behavior who is its context . </li></ul><ul><li>Behavior can access the structural and behvarioal features of the context classifier. </li></ul>
  34. 34. The basic behavior metamodel <ul><li>A BehavioradClassifier can own several behaviors, but each of these behaviors would then have exactly one context. </li></ul><ul><li>Similar, operations (behavioral features) can own behavior. The behavior is the implementation of the operation and the operation is the specification of the behavior. </li></ul><ul><li>The context is identical to that of the classifier, which owns this operation. </li></ul>
  35. 35. Checklist: behavior basics <ul><li>What forms can behaviors have? </li></ul><ul><li>Can behaviors be defined independently as a class? </li></ul><ul><li>Can a classifier own behavior? </li></ul><ul><li>What is the context of a behavior? </li></ul>
  36. 36. The call model <ul><li>Behavior in UML is event oriented by definition. </li></ul><ul><li>The execution of behavior is always triggered by an event . </li></ul><ul><li>The execution of an event can trigger the execution of behavior . </li></ul><ul><li>New events may happen during each execution of behavior . </li></ul><ul><li>Two particular events occur always : the start occurrence and the termination occurrence . </li></ul>
  37. 37. The notational model for executing behavior Request SendRequest CallRequest InvocationOccurrence CallInvocationOccurrence SendInvocationOccurrence SignalOccurrence ReceiveOccurrence CallOccurrence +sendEvent +message +message +receiveEvent 1 1..* 1 1
  38. 38. The call model <ul><li>When a behavior call is triggered by the receipt of a message rather than by an operation call, then this form of request is described by using signals . </li></ul><ul><li>Signals can be arranged in a specialization hierarchy (see next figure). </li></ul>
  39. 39. Event hierarchy Event TriggerEvent CallBehavior Event SpontaneousEvent ChangeEvent TimeEvent Receiving Event Exceptions are a special form of signals. Only active objects can receive signals. Signals always represent an asynchronous call behavior. The receiver of a signal is responsible for selecting the behavior to be executed.
  40. 40. Checklist: the call model <ul><li>How is the execution of behavior triggered? </li></ul><ul><li>What is the Request object? </li></ul><ul><li>What are the two ways to invoke behavior? </li></ul><ul><li>Is the sender or the receiver responsible for selecting the behavior to be executed? </li></ul>
  41. 41. Behavior parameters <ul><li>A behavior can have an arbitrary number of parameters . </li></ul><ul><li>Upon calling a behavior, the input parameters are made available to that behavior. </li></ul><ul><li>The output parameters are filled with values when the behavior terminates . </li></ul>
  42. 42. Behavior parameters <ul><li>The attribute isReentrant (of Behavior ) can be used to define whether the behavior can be called several times concurrently or whether one call to the behavior has to be terminated before another call for tha same behavior can be made. </li></ul>
  43. 43. Behavior parameters <ul><li>The attribute isActive (of BehavioredClassifier ) can be used to whether the classifier can have their own control flows (active objects). </li></ul>
  44. 44. Behavior parameters <ul><li>If an object is not active , then its behavior is executed with other objects in a common control flow. In this case we can state how concurrent calls to a behavior should be handled: </li></ul><ul><ul><li>Concurrent : calls are executed independently of one another and concurrently. </li></ul></ul><ul><ul><li>Sequential : the participating instances have to police the situation themselves (there is no coordination of concurrent calls). </li></ul></ul><ul><ul><li>Guarded : only one behavior is called at a time. Deadlocks have to be handled by the developer. </li></ul></ul>
  45. 45. Checklist:Behavior parameters <ul><li>How can be behaviored classifiers be defined as active objects? </li></ul>
  46. 46. Activity Diagrams <ul><li>The topics refer to the following metamodel areas: </li></ul><ul><ul><li>Package: Activities::BasicActivities </li></ul></ul><ul><ul><ul><li>Nodes </li></ul></ul></ul><ul><ul><ul><li>Edges (flows) </li></ul></ul></ul><ul><ul><ul><li>Actions (basic only) </li></ul></ul></ul><ul><ul><ul><li>Control nodes. </li></ul></ul></ul><ul><li>This topic area constitutes 20 percent of the test. </li></ul>
  47. 47. Definition <ul><li>An activity describes the sequence of actions based on control models and object flow models. </li></ul><ul><li>An activity contains edges and activity nodes-special actions </li></ul><ul><li>An action is an abstract class. Specific subclasses are also defined in UML. They are described in the so-called Action Semantics . </li></ul>
  48. 48. Notation & Semantics <ul><li>An activity is represented by a rectangle with rounded corners including nodes and edges of the activity. The name of the activity appears at the top left of the rectangle. </li></ul><ul><li>An activity is derived from Class so activities themselves can be generalized. </li></ul>
  49. 49. Notation & Semantics <ul><li>An activity (like any behavior in UML) can also have parameters . Objects incoming to or outgoing from an activity model are referred to as the parameters of that activity. </li></ul>
  50. 50. Example of an activity Produced Bottles [empty] New Six-Pack Fill Bottles Label Bottles Bundle Pack Bottles [labeled] Bottles [empty] Bottles [filled] Bottles [filled] [knockOff] [continue] <<precondition>> Boolean expression <<postcondition>>Boolean expression Six-Pack Production Produced Bottles:Bootles New Six-Pack:Six-Pack Six-Pack Actions Pins (input or output parameters of actions) keywords Activity input parameter Activity output parameter Declaration of activity parameters Decision node
  51. 51. Types of activity node ActivityNode ExecutableNode ControlNode ActivityParameterNOde CallBehaviorAction Action Pin ObjectNode
  52. 52. Predefined actions <ul><li>The kinds of action are predefined in UML. Examples: </li></ul><ul><ul><li>Calling a behavior (e.g. Another activity). </li></ul></ul><ul><ul><li>Calling an operation. </li></ul></ul><ul><ul><li>Sending a receiving signals. </li></ul></ul><ul><ul><li>Creating, deleting and changing objects. </li></ul></ul><ul><li>An example of specific action is CallBehaviorAction . The action calls another behavior (another activity or a state machine). Is the case of our example. </li></ul><ul><li>Other could be CreateObjectAction . </li></ul>
  53. 53. ActivityEdge <ul><li>The edges in an activity ( ActivityEdge ) are divided into control flow edges and object flow edges . </li></ul><ul><li>Both edges types are equal as far as the notation –a straight line with an open arrowhead. </li></ul>
  54. 54. The metamodel for activity edges
  55. 55. Connector edge <ul><li>It can easily happen in activity diagrams that you will have to draw and edge across the entire diagrams. </li></ul><ul><li>To ensure easy reading of the diagram, we could introduce connectors . </li></ul><ul><li>A connector is used to split an edge. It’s only a notational means and doesn’t influence the underlying model. </li></ul>
  56. 56. Notation for connectors A ... A
  57. 57. Nodes ActivityNode ExecutableNode ControlNode ActivityParameterNode CallBehaviorAction Action Pin ObjectNode Actions Object nodes Control nodes
  58. 58. Practice <ul><li>Activity diagrams can be used for graphical representations of the kinds of flows that are, for instance, described in use cases. </li></ul><ul><li>Activity diagrams allow you to represent even very complex flows that include many exceptions, variants, jumps and iterations, and still remain clear and understandable. </li></ul>
  59. 59. Checklist: Activities <ul><li>What does an activity represent? </li></ul><ul><li>What does an action represent? </li></ul><ul><li>What are pins? </li></ul><ul><li>What kinds of edge are there? </li></ul><ul><li>What kinds of activity node are there? </li></ul>
  60. 60. Token flow <ul><li>The semantics of an activity is based on a token flow . </li></ul><ul><li>More specifically, control tokens or object tokens flow between nodes over edges. </li></ul>
  61. 61. Token flow <ul><li>These flows obey the following elementary rules : </li></ul><ul><ul><li>An action can start only if tokens are available at all incoming edges (implicit synchronization ; and semantics). </li></ul></ul><ul><ul><li>When an action terminates, a token is made available at all outgoing edges (implicit splitting ; and semantics). </li></ul></ul>
  62. 62. Token flow <ul><li>(Continue...) elementary rules : </li></ul><ul><ul><li>A token flows from one action to the next if </li></ul></ul><ul><ul><ul><li>The token is made available at the outgoing action. </li></ul></ul></ul><ul><ul><ul><li>The leading action is ready to take the token. </li></ul></ul></ul><ul><ul><ul><li>And the rules allow the edge to accept the token flow. </li></ul></ul></ul><ul><ul><li>Every edge has a condition referred to as a guard that has to be true in order to be able to transport tokens. The default is true . </li></ul></ul>
  63. 63. The metamodel for activity edges ValueSpecification 1 +guard {subsets ownedElement} {default value is true}
  64. 64. Token flow <ul><li>There are two types of edge: control flow edges and object flow edges . </li></ul><ul><li>Their notation is identical. </li></ul>
  65. 65. Control flow- “and” semantics A C B A B C Implicit splitting Once action A terminates, a control token is made available at both outgoing edges. After action A , actions B and C start concurrently Implicit synchronization Action C doesn’t start until tokens are available at both incoming edges. Actions A and B have to terminate first
  66. 66. Object Flow-”and” semantics A C B A B C Except by the fact that the actions have input and output pins, the same rules from control flow apply
  67. 67. Object Flow-”or” semantics A C B A B C A has only one output pin , wich means that the action supplies one object token . Outgoing are two edges . Which one of these edges the object token will select is not defined The model behavior cannot anticipated Actions A and B each supply an object token. But action C has only one input pin . Action C would be called twice .
  68. 68. Checklist: Token flow <ul><li>What prerequisite must be met for an action to execute? </li></ul><ul><li>At which outgoing edges are tokens made available when an action terminates? </li></ul><ul><li>When does the or semantics apply to object flows? </li></ul>
  69. 69. Control Nodes <ul><li>Definitions : </li></ul><ul><ul><li>InitialNode : the point of departure for an activity’s flow. A start node. </li></ul></ul><ul><ul><li>ActivityFinalNode : An activity’s end node which causes the defined flow to terminate. </li></ul></ul><ul><ul><li>DecisionNode : a control node with one or several outgoing edges, at which decisions are made based on certain conditions (i.e. at which of the continuing edges the token flow should continue). </li></ul></ul><ul><ul><li>MergeNode : a control node, at which each of several incoming token flows leads immediatly to a common outgoing token flow. </li></ul></ul>
  70. 70. Notation & Semantics Initial Node When calling an activity, a control token is placed on each initial node . If an activity has several initial nodes, there will be several concurrent flows after an activity has been called. It is not mandatory for an activity to have an initial node It has at least one incoming edge, but no outgoing edge . The entire activity terminates as soon as a token reaches a final node, regardlees of how many other tokens are still within the activity. It is not mandatory for an activity to have a final node Final Node
  71. 71. Decision node <ul><li>As soon as a token is supplied over the incoming edge, the guards at the outgoing edges are evaluated . The sequence of evaluation is not defined. </li></ul><ul><li>As son as a condition is true, the token traverses the respective outgoing edge </li></ul>[X>=0] [X<0]
  72. 72. Decision node <ul><li>A decision can also define a behavior (i.e. A complex calculation). Every token arriving over the incoming edge is passed to the behavior before the guard are evaluated. </li></ul><ul><li>The result of such calculation can be accesed in the individual guards. The behavior must not have side effects (no object changes). </li></ul>[X>=0] [X<0] <<decisionInput>> x=sqrt(y)
  73. 73. MergeNode <ul><li>The only purpose of a merge node is to connect incoming edges and one outgoing edge . Nothing is calculated, and nothing is expected. </li></ul><ul><li>Merge and decision can be combined . The rhombus has several incoming and several outgoing control flows . The implicit sequence is important: first the merge and then the decision . </li></ul>[X>=0] [X<0]
  74. 74. The metamodel for control nodes
  75. 75. Checklist: control nodes <ul><li>How many incoming edges can an initial node have? </li></ul><ul><li>What do several edges outgoing from one initial node signify? </li></ul><ul><li>What do several edges incoming into one final node signify? </li></ul><ul><li>What is the meaning of behavior (decision input) that can be defined by a decision? </li></ul>
  76. 76. Object node <ul><li>Def.- An ObjectNode specifies that an object or a set of objects exists within a flow at a certain point in time. </li></ul><ul><li>Object nodes can be used in activities (activity parameter nodes) to serve as incoming or outgoing parameters . </li></ul><ul><li>Or can be used as incoming or outgoing parameters of actions (pins). </li></ul><ul><li>An object flow is a special edge which transports object tokens . </li></ul>
  77. 77. Notation & Semantics <ul><li>An object flow is used to express that the objects involved are required by action nodes or are created or modified by them. </li></ul><ul><li>An action won’t start until the required object are present. </li></ul><ul><li>At the end of an action , the new or modified objects will be made available. </li></ul>
  78. 78. Notation & Semantics <ul><li>Activity parameters can include the name of the object and optionally the object state within square brackets. </li></ul><ul><li>When an activity is called , object tokens are present at all input parameters . </li></ul><ul><li>When an activity terminates , there are object tokens at all output parameters . </li></ul><ul><li>If the corresponding object does not exist, then a null (or zero) token is created and can then be used for any object type </li></ul><ul><li>An initil node is normally not required when there are input parameters. </li></ul>
  79. 79. Notation for activity parameters Make vechicle ready for rental Vehicle: Car Protocol: HandOverProtocol Vehicle Protocol Take down car condition ... Take down car condition Input Parameter Output Parameter Parameter declaration
  80. 80. Notation & Semantics <ul><li>A pin is always allocated to an action . </li></ul><ul><li>There are to types of pins: input pins and output pins . </li></ul><ul><li>An action can have an arbitrary number of pins. </li></ul>
  81. 81. The metamodel for pins
  82. 82. Various notations for pins Action Action Object [state] Object [state] Action Action Object type [state] Action Action An object flow without details
  83. 83. Various object types Activity Section from an activity Identify Customer Display Data Customer Person class Person/Customer Customer Person Object types and object states of output pins and their partners input pins don’t have to be identical , but it should be easy to derive the object type at the input pin from the incoming object types
  84. 84. Labeling object nodes Action Object Type [state] Book vehicle Booking Action Object Name: Type [state] Identify Customer Booker:Customer
  85. 85. Input pins and output pins without edges Action Input pin Output pin An output pin without continuing edges expresses that the pertaining action has an output parameter which, however, doesn’t play a role in the activity’s further flow
  86. 86. A special form of input pin: the value pin Create invoice Tarif.SALESTAX The notation adds a value specification, describing a value in the model, next to the pin. Value pins are used, for example, to model constants in activities
  87. 87. Checklist:Object nodes <ul><li>What happens at the input parameters of an activity when that activity is called? </li></ul><ul><li>What happens at the output parameters of an activity when that activity is terminated? </li></ul><ul><li>How many pins can an action have? </li></ul><ul><li>When may pins modeled alternatively as large rectangles with incoming and outgoind edges? </li></ul>