advance structural modeling(advance relationship)

Upload: aditi-gaurav

Post on 07-Aug-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    1/29

    Advance Structural Modeling

    Advance Relationships

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    2/29

    Advanced relationships

    • Dependency

    Generalization• Association

    • Realization

    • Refinement

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    3/29

    Dependency

    • A dependency is a using relationship, specifying that a change in thespecification of one thing may affect another thing that uses it butnot necessarily the reverse.

    • Graphically, a dependency is rendered as a dashed line, directed tothe thing that is depended on.

    Adding stereotypes to Dependency

    A plain, unadorned dependency relationship can represent thebasic relationship between the classes.

    • However UML defines a number of stereotypes that may be appliedto dependency relationships.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    4/29

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    5/29

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    6/29

    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 twoassociations, one of which is concrete and the other is conceptual.

    • Eg. We can show the relationship between Age and BirthDate byusing a derive dependency, showing Age derived

    from BirthDate.

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

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    7/29

    Cont..

    iv)instanceof • It specifies that the source object is an instance of the target

    classifier.

    • Eg.

    v)Instantiate

    • It specifies that the source creates instances of the target

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

    Car swift

    Car factory Car

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    8/29

    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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    9/29

    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, therebyviolating substitutability

    • It is modeled as private inheritance.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    10/29

    Cont..

    • Eg. Implementation of stack using array but stack doesn’t exhibit

    behavior of an array.

    constraints

    There are four standard constraints that apply to generalization

    relationships.

    i. complete

    ii. incomplete

    iii. disjointiv. overlapping

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    11/29

    Cont..

    i) complete

    • It specifies that all children in the generalization have beenspecified in the model and no additional children are permitted.

    ii) incomplete

    • It specifies that not all children in the generalization have beenspecified and additional children are permitted.

    iii) disjoint

    • It specifies that objects instance will belong to only one sub class orchild class.

    iv) overlapping

    • It specifies that objects instance may belong to more than onesubclass.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    12/29

    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, multiplicityand aggregation UML supports some other properties forassociation.

    i. Navigation

    ii. Visibility

    iii. Qualification

    iv. Interface Specifier

    v. Composition

    vi. Association Classes

    vii. Constraints

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    13/29

    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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    14/29

    Cont..

    Here the navigation is from user to password

    Folder File

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    15/29

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    16/29

    Cont..

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    17/29

    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 thetarget object.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    18/29

    Cont..

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    19/29

    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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    20/29

    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

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    21/29

    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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    22/29

    Cont..

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    23/29

    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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    24/29

    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 onlyconceptual.(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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    25/29

    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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    26/29

    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 andthe 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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    27/29

    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.

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    28/29

    Cont..

  • 8/20/2019 Advance Structural Modeling(Advance Relationship)

    29/29