9UML

Embed Size (px)

Citation preview

  • 7/27/2019 9UML

    1/53

    Unified Modeling Language

    (UML)

    Rajesh Shakya

    2007

  • 7/27/2019 9UML

    2/53

    2

    What is UML?

    UML = Unified Modeling Language

    A language for visualizing, specifying, constructing anddocumenting artifacts of software-intensive systems.

    Examples of artifacts: requirements, architecture, design,source code, test cases, prototypes, etc.

    UML is suitable for modeling various kinds of systems:

    1) enterprise information systems,2) distributed web-based,

    3) real-time embedded system, etc.

  • 7/27/2019 9UML

    3/53

  • 7/27/2019 9UML

    4/53

    4

    Can be classified in two categories:

    1) elements used in structural diagrams

    2) elements used in behavioral diagrams

    Elements

  • 7/27/2019 9UML

    5/53

    5

    Structural Elements

    1) Artifact

    2) Class

    3) Collaboration

    4) Collaboration Occurrence

    5) Component6) Deployment Specification

    7) Interface

    8) Node

    9) Object

    10) Package11) Part

    12) Port

    13) Qualifiers

  • 7/27/2019 9UML

    6/53

    6

    Behavioral Elements

    1) Action

    2) Activity

    3) Actor

    4) Boundary

    5) Choice6) Decision

    7) Exception

    8) Join

    9) Lifeline12) Use Case

    10) Object

    11) Package

  • 7/27/2019 9UML

    7/53

    7

    Structural Elements

    a) static part of the model to represent conceptualelements

    b) nouns of the model

    We illustrate:

    1) class

    2) interface

    3) collaboration4) component

    5) node

  • 7/27/2019 9UML

    8/53

    8

    Element 1: Class

    1) description of a set of objects that share thesame attributes, operations, relationships andsemantics

    2) implements one or more interfaces

    3) graphically rendered as a rectangle usuallyincluding a name, attributes and operations

    4) can be also used to represent actors, signals andutilities

  • 7/27/2019 9UML

    9/53

    9

    Element 2: Interface

    1) collection of operations that specifies a serviceof a class

    2) describes the externally visible behaviour,partial or complete, of a class

    3) defines a set of operation signatures but nottheir implementations

    4) rendered as a circle with a name

  • 7/27/2019 9UML

    10/53

    10

    Element 3: Collaboration

    1) defines an interaction between elements

    2) several elements cooperating to deliver a behavior, rather than

    individual behavior

    3) includes structural and behavioral dimensions

    4) represents implementations of patterns of cooperation that make

    up a system5) represented as a named ellipse drawn with a dashed line

  • 7/27/2019 9UML

    11/53

    11

    Element 4: Component

    1) physical, replaceable part of a system that conforms to and

    provides the realization of a set of interfaces

    2) represents deployment components such as COM+ or Java Beans

    components

    3) represents a physical packaging of logical elements such as

    classes, interfaces and collaborations4) it can also be used to represent applications, files, libraries, pages

    and tables

  • 7/27/2019 9UML

    12/53

    12

    Element 5: Node

    1) a physical element, exists at run time

    2) represents a computational resource withmemory and processing capacity

    3) a set of components may reside in a node

    4) components may also migrate from one node toanother

    5) graphically modeled as a cube

  • 7/27/2019 9UML

    13/53

    13

    Behavioral Elements

    a) represent behavior over time and space

    b) verbs of the model

    We illustrate:

    6) use case

    7) activity

    8) actor

    9) package

  • 7/27/2019 9UML

    14/53

    14

    Element 6: Use Case

    1) description of a sequence of actions that asystem performs to deliver an observable resultto a particular actor

    2) used to structure the behavioral elements in a

    model3) realized by collaboration

    4) graphically rendered as an ellipse drawn with asolid line

  • 7/27/2019 9UML

    15/53

    15

    Element 7: Activity

    1) is the specification of a parameterized sequence ofbehavior

    2) specifies the coordination of executions of subordinatebehaviors, using a control and data flow model

    3) may contain actions of various kinds: occurrences of primitive functions, such as arithmetic functions.

    invocations of behavior, such as activities

    communication actions, such as sending of signals.

    manipulations of objects, such as reading or writing attributes or

    associations.

  • 7/27/2019 9UML

    16/53

    16

    Element 8: Actor

    1) is a user of the system, including:a) a human user

    b) a machine

    c) another system

    2) is anything that interacts with the system from theoutside or system boundary

    3) does not necessarily represent a specific physical entity: a single physical entity may play the role of several different

    actors,

    a given actor may be played by multiple physical entities

  • 7/27/2019 9UML

    17/53

    17

    Element 9: Package

    Grouping element of UML:1) organizes diagrams

    2) primary kind of grouping anddecomposition

    3) conceptual, only available at developmenttime

    4) graphically represented as a tabbed

    folder

  • 7/27/2019 9UML

    18/53

    18

    Relationships

    Four basic types of relationships:

    1) dependency

    2) associations3) generalization

    4) realization

    Meanings are consistent with the basicObject Oriented relationship types

    described earlier.

  • 7/27/2019 9UML

    19/53

    19

    Relationship 1: Dependency

    A semantic relationship between twoelements in which a change to oneelement (independent element) may affect

    the meaning of another(dependentelement).

    Given as a directed dashed line possiblywith a label:

  • 7/27/2019 9UML

    20/53

    20

    Relationship 2: Association

    1) a structural relationship describing a set oflinks

    2) links are connections between objects

    3) aggregation is a special type of associationdepicting the whole-part relationship

    4) association is presented as a solid line,possibly directed, labeled and with adornments(multiplicity and role names)

  • 7/27/2019 9UML

    21/53

    21

    Relationship 3: Generalization

    1) a relationship in which objects of aspecialized element (child) are substitutable forobjects of a generalized element (parent)

    2) child elements share the structure/behavior of

    the parent3) rendered graphically as a solid line withhollow arrowhead pointing to the parent

  • 7/27/2019 9UML

    22/53

    22

    Relationship 4: Realization

    1) a semantic relationship between elements, wherein oneelement specifies a contract and another guarantees tocarry out this contract

    2) relevant in two basic scenarios:

    a) interfaces versus realizing classes/componentsb) uses cases versus realizing collaborations

    3) graphically depicted as a dashed arrow with hollowhead, a cross between dependency and generalization

  • 7/27/2019 9UML

    23/53

    23

    Diagrams

    A diagram is a graph presentation of a set

    of elements and relationships where:

    a) nodes are elements

    b) edges are relationships

    Can visualize a system from variousperspective, thus is a projection of a

    system.

  • 7/27/2019 9UML

    24/53

    24

    Diagram Types

  • 7/27/2019 9UML

    25/53

    25

    Diagram 1: Class

    Class Diagrams:

    1) show a set of classes, interfaces and

    collaborations, and their relationships

    2) address static design view of a system

  • 7/27/2019 9UML

    26/53

    26

    Class Diagram Example

  • 7/27/2019 9UML

    27/53

    27

    Diagram 2: Object

    Object Diagrams:

    1) show a set of objects and their

    relationships

    2) static snapshots of element instances

    found in class diagrams

  • 7/27/2019 9UML

    28/53

    28

    Object Diagram Example

  • 7/27/2019 9UML

    29/53

    29

    Diagram 3: Component

    Component Diagrams:

    1) show the organization and dependencies

    amongst a set of components

    2) address static implementation view of a

    system

    3) show how components map to one or more

    classes, interfaces and collaborations

  • 7/27/2019 9UML

    30/53

    30

    Component Diagram Example

  • 7/27/2019 9UML

    31/53

    31

    Diagram 4: Composite Structure

    Composite Structure Diagrams:

    reflect the internal collaboration of classes,

    interfaces or components to describe a

    functionality.

    are used to express run-time architectures,

    usage patterns, and the participating

    elements' relationships.

  • 7/27/2019 9UML

    32/53

    32

    Composite Structure Example

  • 7/27/2019 9UML

    33/53

    33

    Diagram 5: Package

    Package Diagrams:

    show the organization of packages and

    their elements

    provide a visualization of the namespaces.

  • 7/27/2019 9UML

    34/53

    34

    Package Diagram Example

  • 7/27/2019 9UML

    35/53

    35

    Diagram 6: Deployment

    Deployment Diagrams:

    show configuration of run-time processing

    nodes and the components hosted on

    them

    address the static deployment view of an

    architecture

    are related to component diagram with

    nodes hosting one or more components

  • 7/27/2019 9UML

    36/53

    36

    Deployment Diagram Example

  • 7/27/2019 9UML

    37/53

    37

    Diagram 7: Use Case

    Use Case Diagrams:

    show a set of actors and use cases, and

    their relationships

    address static use case view of the system

    are important for organizing and modeling

    the external behavior of the system

  • 7/27/2019 9UML

    38/53

    38

    Use Case Diagram Example

  • 7/27/2019 9UML

    39/53

    39

    Diagram 8: Activity

    Activity Diagrams:

    show control/data flows from one activity to

    another

    address the dynamic view of a system,

    useful for modeling its functions

    emphasize the flow of control among

    objects

  • 7/27/2019 9UML

    40/53

    40

    Activity Diagram Example

  • 7/27/2019 9UML

    41/53

    41

    Diagram 9: State

    State Diagrams:

    show a state machine consisting of states,

    transitions, events, and activities

    address the dynamic view of a system

    are important in modeling the behavior of

    an interface, class or collaboration

    emphasize the event-driven ordering

  • 7/27/2019 9UML

    42/53

    42

    State Diagram Example

  • 7/27/2019 9UML

    43/53

    43

    Diagram 10: Sequence

    Sequence Diagrams:

    1) show interactions consisting of a set of

    objects and the messages sent and

    received by those objects

    2) address the dynamic behavior of a

    system with special emphasis on the

    chronological ordering of messages

  • 7/27/2019 9UML

    44/53

    44

    Sequence Diagram Example

  • 7/27/2019 9UML

    45/53

    45

    Diagram 11: Communication

    Communication Diagrams:

    1) show the interactions between elements at run-time

    2) are used to visualize inter-object relationships.

    They are much like sequence diagrams:

    communication diagrams better for visualizing

    inter-object relationships sequence diagrams better for visualizing

    processing over time

  • 7/27/2019 9UML

    46/53

    46

    Communication Diagram Example

  • 7/27/2019 9UML

    47/53

    47

    Diagram 12: Timing

    Timing Diagrams:1) define the behavior of different objects within a time-scale

    2) provide a visual representation of objects changing state and

    interacting over time

    3) show the interaction between timed events and the time and

    duration constraints that govern them.

    Timing diagrams can be used for defining hardware-driven or

    embedded software components.

    They can also be used for specifying time-driven business processes.

  • 7/27/2019 9UML

    48/53

    48

    Timing diagram example

  • 7/27/2019 9UML

    49/53

    49

    Diagram 13: Interaction Overview

    Interaction Overview Diagrams:

    1) visualize the cooperation between other

    interaction diagrams to illustrate a control

    flow serving an encompassing purpose

    2) are a variant of activity diagrams

    3) can include sequence, communication,

    interaction overview and timing diagrams.

  • 7/27/2019 9UML

    50/53

    50

    Interaction Overview Example

  • 7/27/2019 9UML

    51/53

    51

    UML Summary 1

    A model provides a blueprint of a system.

    UML is a language for visualizing, specifying,constructing and documenting artifacts ofsoftware-intensive systems.

    UML is process-independent but recommended foruse with processes that are:

    1) use case driven,

    2) architecture-centric,3) iterative, and

    4) incremental.

  • 7/27/2019 9UML

    52/53

    52

    UML Summary 2

    There are three building blocks which characterize UML:1) elements,

    2) relationships, and

    3) diagrams.

    Elements can be classified based on the diagrams they are used:1) structural diagrams

    2) behavioral diagrams

    There are four basic types of relationships in UML:

    dependency association

    generalization

    realization

  • 7/27/2019 9UML

    53/53

    53

    UML Summary 3

    UML provides 13 diagrams for modelling:1) class diagrams

    2) object diagrams

    3) component diagrams

    4) composite structure diagrams

    5) package diagrams6) deployment diagrams

    7) use case diagrams

    8) activity diagrams

    9) state machine diagrams

    10) sequence diagrams11) communication diagrams

    12) timing diagrams

    13) interaction overview diagrams