Notes - 1057 - Unit II
Notes - 1057 - Unit II
Relationships in UML
• Link
• Association
• Aggregation
• Composition
• Generalization
• Realization
• Dependencies
Link
• Link is a physical or conceptual connection between objects
• E.g. Ram sits on Chair. “Sits on” is a link between object Ram and
object chair.
• It is denoted by solid line
Association
• Association is a group of links which are similar in structure and
semantics. Association is between classes
• Properties of association
• Bidirectional in nature
• Unary: if association of a class is with itself
• Binary: b/w two classes
• Ternary: among three classes
• M-ary: among m classes
End names of an association
• Multiplicity
• Role names
• Link attribute/ association attribute
• Link class/ association class
• Navigation
• Ordering
• Aggregation
• Composition
Multiplicity
• A state model describes the sequences of operations that occur in response to external stimuli.
• As opposed to what the operations do, what they operate on, or how they are implemented.
• Changes to objects and their relationships over time should be examined.
• A state model consists of multiple state diagrams, one for each class with temporal behavior that
is important to an application.
• A state diagram relates events and states.
• Events represent external stimuli
• States represent values of (attributes) object.
What is Event ?
• Examples:
• User depresses left button
• Flight 123 departs from Amman
• Power turned on
• Alarm set
• Paper tray becomes empty
• Events corresponds to verb in the past/present tense or the onset of some condition.
• By definition an event happens instantaneously. The time at which an event occurs is an implicit
attribute of the event.
Events…
• One event may logically precede or follow another, or the two events are unrelated. Events that
are causally unrelated are said to be concurrent.
• Examples of error events:
• Motor jammed
• Transaction aborted
• Timeout
• Example: The state of a bank is either solvent or insolvent, depending on whether its assets
exceed its liabilities.
• Notation:
• The objects in a class have a finite number of possible states. One or possibly larger number.
• Each object can only be in one state at time. Objects may parade through one to more states in
their lifetime
• A state specifies the response of an object to input events.
• The response may include the invocation of a behavior or a change of state.
States
• A state diagram is a graph whose nodes are states and whose directed arcs are transitions
between states.
• A state diagram specifies or describes the state sequence caused by event sequences.
• State names must be unique within the scope of the state diagram.
• All objects in a class execute the state diagram for that class.
• The class state diagram models the common behavior of the class objects.
State diagram example
Activity
• An activity can be performed upon a transition, upon the entry to or exit from a
state or upon some event within a state.
Examples
Examples
Nested State Diagram