UML - Structure Diagram Component and Deployment and Packag

download UML - Structure Diagram Component and Deployment and Packag

of 25

Transcript of UML - Structure Diagram Component and Deployment and Packag

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    1/25

    UML : COMPONENT DIAGRAM

    What Is a Component Diagram?

    A component diagram containsappropriately

    enoughcomponents, along with interfaces and

    relationships.

    a s a omponenA component is a modular part of a system. Because

    it's the software implementation of one or more

    classes, a component resides in a computer, not in themind of an analyst. A component provides interfaces

    to other components.www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    2/25

    UML : COMPONENT DIAGRAM

    In UML 1.x, data files, tables, executables, documents,

    and dynamic link libraries were defined as

    components. In fact, modelers used to classify thesekinds of items as deployment components, work

    product components, and execution components.

    UML 2.0 refers to them instead as artifactspieces ofinformation that a system uses or produces.

    A component, by contrast, defines a system's

    functionality. Just as a component is the

    implementation of one or more classes, an artifact (if

    it's executable) is the implementation of a component

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    3/25

    UML : COMPONENT DIAGRAM

    Representing a Component in UML 1.x and UML 2.0

    In UML 1.x the component diagram's main icon is arectangle that has two rectangles overlaid on its left side.

    UML 2.0 provides a new component icon. In UML 2.0, the

    icon is a rectangle with the keyword component near thetop. Sometimes we indicate the type of component in the

    stereotype like: , ,

    etc www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    4/25

    UML : COMPONENT DIAGRAM

    if the component is a member of a package, you can

    prefix the component's name with the name of the

    package. You can also show the componentsoperations in a separate panel.

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    5/25

    UML : COMPONENT DIAGRAM

    Representing Interfaces :

    The interfaces can be represented in two ways.

    The first shows the interface as a rectangle that

    contains interface-related information. It's connected

    o e componen y e as e ne an arge opentriangle that indicate realization.

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    6/25

    UML : COMPONENT DIAGRAM

    Representing Interfaces :

    The interfaces can be represented in two ways.

    The second shows the interface as small circle

    connected to the component by a solid line.

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    7/25

    UML : COMPONENT DIAGRAM

    Dependency:

    the relationship between a component and an

    interface through which it accesses anothercomponent.

    represen ng epen ency:Dependency can be

    represented as

    a dashed line with

    an arrowhead.

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    8/25

    UML : COMPONENT DIAGRAM

    Inheritance :

    Inheritance relationships can be

    represented by a solid arrow

    between the parent component

    and child component, the arrow head

    at parent component.

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    9/25

    UML : COMPONENT DIAGRAM

    Exxample 1:

    an application called ColorSlide. This is a set of three

    sliders that enable you

    to mix amounts of red, green, and

    blue to create a color. One slidercorresponds to each of those colors.

    The location of each slider determinesthe amount of its color that goes into

    the mix. The created color appears in a panel below

    the sliders. www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    10/25

    UML : COMPONENT DIAGRAMWe will illustrate some components of the application

    awt stands for "abstract windowing toolkit," a group of

    components that displayand control a graphic user

    interface (GUI). The specific

    UML : COMPONENT DIAGRAM

    components for this program are

    Color (which displays a color),

    GridLayout and FlowLayout(which arrange the elements in the GUI)

    and Graphics and Graphics2D

    (which paint the GUIthat is, they render it onscreen).www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    11/25

    UML : COMPONENT DIAGRAM

    Example 2:

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    12/25

    UML : DEPLOYMENT DIAGRAM

    deployment diagram:

    depicts a static view of the runtime configuration of

    hardware nodes and the software components thatrun on those nodes. UML deployment diagrams show

    ,

    installed on that hardware, and the middleware used

    to connect the disparate machines to one another.

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    13/25

    UML : DEPLOYMENT DIAGRAM

    You create a UML deployment model to:

    1. explore the issues involved in installing your system

    into production,2. explore the dependencies that your system has with

    other systems that are currently in, or planned for,

    your pro uction environment,3. depict a major deployment configuration of a

    business application,

    4. design the hardware and software configuration ofan embedded system, or

    5. depict the hardware/network infrastructure of an

    organization. www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    14/25

    UML : DEPLOYMENT DIAGRAM

    UML 2.0 now formally defines a device as a node that

    executes artifacts.

    (Remember an

    Executable is now

    classified as an artifact).Representing Node:

    You supply a name

    for the node, and you

    can add the keyword

    Device, although it's usually not necessary.www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    15/25

    UML : DEPLOYMENT DIAGRAM

    Nodes and Components:

    In UML 2 nodes can also be software. Components,

    represent software artifacts such as file, framework,or domain component.

    ame o es escr p ve erms c en ,Application Server, Database Server etc).

    Model Only Vital Software Components (dont

    include unnecessary software that dont involved).

    Apply Consistent Stereotypes to Components.

    Apply Visual Stereotypes to Nodes.www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    16/25

    UML : DEPLOYMENT DIAGRAM

    Dependency and Communication Associations

    Communication associations, often called

    connections, are depicted as lines connecting nodes.Dependencies between components are modeled as

    .

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    17/25

    UML : DEPLOYMENT DIAGRAM

    Example 1:

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    18/25

    UML : PACKAGE DIAGRAM

    As its name implies, a package is designed to group

    other UML diagrams (like classes or use cases).

    Surround the grouped elements with a tabbed-folder icon and you have packaged them.

    organize your diagrams.

    Create a package diagram to

    1. depict a high-level overview of your requirements

    2. depict a high-level overview of your design

    3. logically modularize a complex diagramwww.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    19/25

    UML : PACKAGE DIAGRAM

    Inter-package Relationships:

    Packages can relate to one another in either of three

    ways: One package can generalize another, depend onanother, or refine another.

    enera za on epen ency :

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    20/25

    UML : PACKAGE DIAGRAM

    Refinement relationships :

    Refinement is all about levels of detail. One package

    refines another if it contains the same elements butwith more detail.

    en you wr e a oo , or examp e, you s ar w aproposal that briefly summarizes each chapter. Lets

    suppose each chapter summary is an owned element

    in package called Proposal . Lets also suppose thatcompleted book is a package owned element are

    finished chapters. In this context the completed book

    package is a refinement of the proposal package.www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    21/25

    UML : PACKAGE DIAGRAM

    Representing Refinement relationship :

    There are two ways to visualize this relationship:

    www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    22/25

    UML : PACKAGE DIAGRAM

    Advices for creating Packages :

    1. Give Packages Simple, Descriptive Names

    2. Apply Packages to Simplify Diagrams3. Packages Should be Cohesive

    then you likely have put several unrelated things intothe package.

    4. Package Dependencies Should Reflect Internal

    RelationshipsNote : When one package depends on another, it implies

    that there are one or more relationships between the

    contents of the two packageswww.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    23/25

    UML : PACKAGE DIAGRAM

    5. Avoid Cyclic Dependencies Between Packages

    Avoid the situation in which package A is dependenton package B which is dependent on package Cwhich in turn is dependent on package A in this

    , .

    packages are coupled to one another, they willbe harder to test, maintain, and enhance over

    time. Cyclic dependencies are a good indicatorthat you need to refactor one or more packages,removing the elements from them that are

    causing the cyclic dependency.www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    24/25

    UML : today summery

    1. Component diagram

    The implementation view of a system.

    Displays the dependencies between software components.

    2. Deployment diagram

    The environment view of a system.

    Shows the h sical relationshi s amon software and

    hardware components. Each node represents a piece of hardware.

    Connections show communication paths.

    3. Package diagram Diagrams are arranged into logically-ordered packages.

    Package diagrams show relationships and dependenciesbetween packages.

    Package diagrams are essential for large projects.www.mahmoud-a.com

  • 7/28/2019 UML - Structure Diagram Component and Deployment and Packag

    25/25

    UML : today summery

    References :

    1. Systems Analysis & Design with UML, 2nd Edition.

    2. Elements of UML 2.0 style.

    3. Software Engineering - Sams - Teach Yourself Uml

    In 24 Hours.

    www.mahmoud-a.com