uml - structural and behavioral things

Upload: honalemangesh

Post on 04-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 UML - Structural and Behavioral Things

    1/34

    Things and Relationships In Detail

    0

  • 8/13/2019 UML - Structural and Behavioral Things

    2/34

    Conceptual Model of UML

    Things Structural things

    Behavioral things

    Grouping things

    Annotation things

  • 8/13/2019 UML - Structural and Behavioral Things

    3/34

    Structural Things

    Nouns of UML models

    Examples:

    Class

    Interface

    Collaboration

    Use case

    Components

    Artifacts

    Node

  • 8/13/2019 UML - Structural and Behavioral Things

    4/34

    Structural Modeling: Core Elements

    3

    Construct Description Syntaxclass a description of a set of objects

    that share the same attributes,operations, methods, relationshipsand semantics.

    interface a named set of operations thatcharacterize the behavior of anelement.

    component a modular, replaceable andsignificant part of a system that

    packages implementation andexposes a set of interfaces.node a run-time physical object that

    represents a computationalresource.

    interface

  • 8/13/2019 UML - Structural and Behavioral Things

    5/34

    Structural Modeling: Core Elements(contd)

    4

    Construct Description Syntax

    constraint a semantic condition or restriction.

    {constraint}

    An extension mechanism useful for specifying structural elements.

  • 8/13/2019 UML - Structural and Behavioral Things

    6/34

    Class

    Description of a set of objects that share the same

    attributes, operations, relationships and semantics.

    Note that the operations open( ), close( ), etc. are

    behavioral things, so a class can also be a grouping thing

    Window

    display ()

    size: Areavisibility: Boolean

    hide ()

    Window

    Window

    +default-size: Rectangle#maximum-size: Rectangle

    +create ()

    +display ()

    +size: Area = (100,100)#visibility: Boolean = true

    +hide ()

    -xptr: XWindow*

    -attac

    hXWindow(xwin:Xwindow*)

    {abstract,author=Joe,status=tested}

  • 8/13/2019 UML - Structural and Behavioral Things

    7/34

    Interface

    Collection ofoperations that

    specify a service of a

    class or component

    Describes the

    externally visible

    behavior of a

    componentUsually attached to a

    class or other

    component

  • 8/13/2019 UML - Structural and Behavioral Things

    8/34

    Interfaces: Shorthand Notation

    7

    +create()

    +login(UserName, Passwd)

    +find(StoreId)

    +getPOStotals(POSid)

    +updateStoreTotals(Id,Sales)

    +get(Item)

    -storeId: Integer

    -POSlist: List

    Store

    POSterminal

    POSterminalHome

    StoreHome

    Store

    POSterminal

  • 8/13/2019 UML - Structural and Behavioral Things

    9/34

    Interfaces: Longhand Notation

    8

    +create()

    +login(UserName, Passwd)+find(StoreId)

    +getPOStotals(POSid)

    +updateStoreTotals(Id,Sales)

    +get(Item)

    -storeId: Integer

    -POSlist: List

    Store

    POSterminal

    POSterminalHome

    StoreHome

    POSterminal

    +getPOStotals(POSid)

    +updateStoreTotals(Id,Sales)

    +get(Item)

    Store

  • 8/13/2019 UML - Structural and Behavioral Things

    10/34

  • 8/13/2019 UML - Structural and Behavioral Things

    11/34

    Components & Nodes

    Component Modular part of system

    design that hides itsimplementation behindset of external interfaces

    A physical packaging ofotherwise logicalelements (i.e., accessiblethrough the interfaces)

    Node Physical element that

    exists at runtime andrepresents acomputational resourcehaving some memoryand processing ability

  • 8/13/2019 UML - Structural and Behavioral Things

    12/34

    Conceptual Model of UML

    Building blocks of the UML Things

    First class citizens Relationships

    Tie things together Diagrams

    Group interesting collections of things Things

    Structural things

    Behavioral things

    Grouping things

    Annotation things

  • 8/13/2019 UML - Structural and Behavioral Things

    13/34

    Behavioral Things

    Dynamic part of UML models Verbs of model, representing behavior over time and space

    Generally connected to classes, collaborations & objects.

    3 kinds:

    Interaction

    State Machine

    Actions

  • 8/13/2019 UML - Structural and Behavioral Things

    14/34

    Interaction

    Set of messages exchanged among objects within a context to

    accomplish a purpose.

    An interaction includes messages, action sequences(behavior invoked

    by a message) and links (relationships between objects)

    Points to object that receives the messages

    display

  • 8/13/2019 UML - Structural and Behavioral Things

    15/34

    Example

    Message is called show

    Sent from button to window

    In real world, a button object sends a show message to a window

    object.

  • 8/13/2019 UML - Structural and Behavioral Things

    16/34

  • 8/13/2019 UML - Structural and Behavioral Things

    17/34

  • 8/13/2019 UML - Structural and Behavioral Things

    18/34

  • 8/13/2019 UML - Structural and Behavioral Things

    19/34

    Annotational Things

    Comments to describe, illuminate or remark about any element in a

    model.

    Note

    Used for informal or formal text

    Used for specifying some aspect outside the model

    This is a note which acts

    like a comment!

  • 8/13/2019 UML - Structural and Behavioral Things

    20/34

  • 8/13/2019 UML - Structural and Behavioral Things

    21/34

    Structural Modeling: Core Relationships

    20

    Construct Description Syntax

    association a relationship between two or moreclassifiers that involves connectionsamong their instances.

    aggregation A special form of association thatspecifies a whole-part relationship

    between the aggregate (whole) andthe component part.

    generalization a taxonomic relationship between amore general and a more specificelement.

    dependency a relationship between two modelingelements, in which a change to onemodeling element (the independentelement) will affect the other modelingelement (the dependent element).

  • 8/13/2019 UML - Structural and Behavioral Things

    22/34

    Structural Modeling: Core Relationships(contd)

    21

    Construct Description Syntax

    realization a relationship between a specificationand its implementation.

  • 8/13/2019 UML - Structural and Behavioral Things

    23/34

    Relationships

    Dependency

    Relationship between two things where a change in one thing (the

    "independent" thing) may affect the meaning of another thing (the

    "dependent" thing)

    Alternatively dependent thing uses independent thing Arrow goes from the "dependent" thing to the "independent" thing.

    Example:

    Window depends on Event

    Window uses Event

  • 8/13/2019 UML - Structural and Behavioral Things

    24/34

    Association

    Structural relationship that describes a set of links; i.e., relationships

    between objects.

    May have direction, may include a label, and often containing

    adornments such as multiplicity and role names:

    Example:

  • 8/13/2019 UML - Structural and Behavioral Things

    25/34

    Generalization

    Specialization/generalization relationship in which objects of the

    specialized element ("child") are substitutable for objects of the

    generalized element ("parent").

    Child shares structure and behavior of parent

    Example: Employee is a kind of Person

  • 8/13/2019 UML - Structural and Behavioral Things

    26/34

    Realization

    One element specifies a "contract" that another element must carry out.

    Open-headed arrow points from the realizer to the element with

    the contract

    The element carrying out the contract is said to realize the other

    element. Example:

  • 8/13/2019 UML - Structural and Behavioral Things

    27/34

    Aggregation

    A composite aggregation (filled diamond) means that the multiplicity

    at the composite (part) end may be at most one.

    Shared aggregation (hollow diamond) means that the multiplicity at

    the composite end may be more than one.

    26

    Construct Description Syntax

    aggregation A special form of association thatspecifies a whole-part relationship

    between the aggregate (whole) andthe component part.

  • 8/13/2019 UML - Structural and Behavioral Things

    28/34

    Aggregation

    Aggregation is the part-whole relationship. It relates classes,

    representing parts (or components) to the whole (or assembly) class.

    27

  • 8/13/2019 UML - Structural and Behavioral Things

    29/34

    UML Aggregation

    In UML there are three types of aggregation:

    Normal Aggregation

    Shared Aggregation

    Composition aggregation

    28

  • 8/13/2019 UML - Structural and Behavioral Things

    30/34

  • 8/13/2019 UML - Structural and Behavioral Things

    31/34

    Composition Aggregation Example

    30

    Aircraft

    Engine Wing Fuselage

    Door LandingGear

    2+

    21+

  • 8/13/2019 UML - Structural and Behavioral Things

    32/34

    Composition

    31

    Window

    scrollbar [2]: Slidertitle: Headerbody: Panel

    Window

    scrollbar title body

    Header Panel

    21 1

    Slider

    111

  • 8/13/2019 UML - Structural and Behavioral Things

    33/34

    Composition (contd)

    32

    scrollbar:Slider

    Window

    2

    title:Header1

    body:Panel1

  • 8/13/2019 UML - Structural and Behavioral Things

    34/34

    Aggregation

    Aggregation is most useful when there are common

    properties of components that can be attached to the

    assembly as a whole

    Or where operations can propagate from container to

    contained objects

    Parts explosions are the most compelling examples of

    aggregation

    33