Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

Advance Structural Modeling

Advance Relationships

Advanced relationships
Dependency
Generalization
Association
Realization
Refinement

Dependency
A dependency is a using relationship, specifying that a change in the
specification of one thing may affect another thing that uses it but
not necessarily the reverse.
Graphically, a dependency is rendered as a dashed line, directed to
the thing that is depended on.

Adding stereotypes to Dependency


A plain, unadorned dependency relationship can represent the
basic relationship between the classes.
However UML defines a number of stereotypes that may be applied
to dependency relationships.

Stereotypes apply to Dependency


There are eight stereotypes that apply to dependency relationships
among classes and objects in class diagrams.

i.
ii.
iii.
iv.
v.
vi.
vii.
viii.

bind
derive
friend
instanceOf
instantiate
Powertype
Refine
use

Cont..
i)bind
It specifies a relationship between a template (as supplier) and a
model element generated from the template( as client)
Map-client
Order map- supplier

Specifies that the source instantiates the target template using the
given actual parameters.
Bind includes a list of actual arguments that map to the formal
arguments of the template.

Cont..
ii)derive
It specifies that the source may be .computed from the target.
It is used to model the relationship between two attributes or two
associations, one of which is concrete and the other is conceptual.
Eg. We can show the relationship between Age and BirthDate by
using a derive dependency, showing Age derived
from BirthDate.

iii)Friend
It Specifies that the source is given special visibility into the target.

Cont..
iv)instanceof
It specifies that the source object is an instance of the target
classifier.
<<instance of>>
Eg.
Car
swift

v)Instantiate
It specifies that the source creates instances of the target
<<instanciate>>

Car factory

Car

That is car class is instantiated by the car factory class.

Cont..
vi) Powertype: It specifies that the target is a powertype of the source; a
powertype is a classifier whose objects are all the children of
a given parent.
vii) Refine
It specifies that the source is at a finer degree of abstraction
than the target.
viii) use
It specifies that the semantics of the source element depends
on the semantics of the public part of the target.

Generalization
A generalization is a relationship between a general thing (called
the super class or parent) and a more specific kind of that thing
(called the subclass or child).
UML specifies only one stereotype that can be applied to
generalization.

Stereotype
Implementation
It specifies that the child inherits the implementation of the parent
but does not make public nor support its interfaces, thereby
violating substitutability
It is modeled as private inheritance.

Cont..
Eg. Implementation of stack using array but stack doesnt exhibit
behavior of an array.

constraints
There are four standard constraints that apply to generalization
relationships.

i.
ii.
iii.
iv.

complete
incomplete
disjoint
overlapping

Cont..
i) complete
It specifies that all children in the generalization have been
specified in the model and no additional children are permitted.

ii) incomplete
It specifies that not all children in the generalization have been
specified and additional children are permitted.

iii) disjoint
It specifies that objects instance will belong to only one sub class or
child class.

iv) overlapping
It specifies that objects instance may belong to more than one
subclass.

Association
An association is a structural relationship, specifying that objects of
one thing are connected to objects of another.
Apart from the four basic adornments ie name, role, multiplicity
and aggregation UML supports some other properties for
association.

i.
ii.
iii.
iv.
v.
vi.
vii.

Navigation
Visibility
Qualification
Interface Specifier
Composition
Association Classes
Constraints

Cont..
i)Navigation
Navigation is an adornments to an association that shows the path
of traversal.
In an association it is possible to navigate from objects of one kind
to objects of other kind.
It is represented with an arrowhead pointing to the direction of
traversal.
Default is (
) no arrow ie either left to right or right to left.
By default navigation across an association is bidirectional.

Cont..

Here the navigation is from user to password

Folder

File

Cont..
ii) Visibility
It specifies the accessability of an object at a particular end outside
the association.
The visibility can be private, public, protacted.
The default visibility is the public(+).
The private visibility(-) indicates that objects at that end are not
accessible to any objects outside the association.
The protected visibility(#) indicates that objects at that end are not
accessible to any objects outside the association, except for
children of the other end.

Cont..

Cont..
iii) Qualification
Qualifier is a special attribute that reduces the effective multiplicity
of an association.
One to many and many to many associations may be qualified.
The qualifier distinguishes among the set of objects at the many
end of the association.
In UML, a qualifier is represented as a small rectangle attached to
the end of the association and placing the attribute in the rectangle.
The source object together with the value of the qualifiers gives the
target object.

Cont..

Cont..
iv)Interface Specifier
An interface is a collection of operations that are used to specify a
service of a class or a component.

Every class may realize many interfaces.


The interface specifiers are represented as rolename: Iname
Where Iname is the name of the interface and role name is the type of the
role in a class of association.

Cont..
In this example the person
class in the role of supervisor
realises the IM anager
interface and in the role of
worker realise Iemployee
interface

Cont..
v) Composition
Composition is a form of aggregation, with strong ownership.
In composition /composite aggregation an object may be a part of
only one composite at a time.
In composition, the whole is responsible for the destruction of its
parts. That means that the composite must manage the creation
and destruction of its parts.
In UML composition is represented as a plain association with a
filled diamond(
) at the whole end.

Cont..

Cont..
vi) Association Classes
An association class can be seen as an association that also has
class properties, that means it contains attributes and operations.
In UML an association class is represented as a class symbol
attached by dashed line(-----------) to the association.

Cont..
vii) Constraints
UML defines 5 constraints that are applied to association.

i)

Implicit
It specifies that the relationship is not manifest but, rather, is only
conceptual.(Relation between two child class will exist if it exist
for the base classes.)

ii) Ordered

It specifies that the set of objects at one end of an


association are in an explicit order.

Cont..
iii) Changeable

The links between objects may be added, removed, and changed


freely.

iv) addOnly

New links may be added from an object on the opposite end of


the association(without removing the existing link)

v) Frozen
A link, once added from an object on the opposite end of the
association, may not be modified or deleted.

Realization
A realization is a semantic relationship between classifiers in which
one classifier specifies a contract that another classifier guarantees
to carry out.
That means realization relationship can be shown between
interface and a class where the interface provide the contract and
the class carries out.
Graphically, a realization is rendered as a dashed directed line with
a large open arrowhead pointing to the classifier that specifies the
contract.

Cont..
Realization can be shown in two ways:1. Canonical Form
2. Elided Form

Canonical Form:
In canonical form, the interface stereotype is used along with a
dashed directed line with a large open arrowhead.

Elided Form
The elided form uses interface lolipop notation.

Cont..

Thank you

You might also like