component diagram

35
COMPONENT DIAGRAM COMPONENT DIAGRAM in UML 2.0 in UML 2.0 Veronica Carrega Veronica Carrega

Upload: ahmed-yousef

Post on 01-Jul-2015

6.545 views

Category:

Education


1 download

DESCRIPTION

How to make Component Diagram in UML.

TRANSCRIPT

Page 1: Component Diagram

COMPONENT COMPONENT DIAGRAMDIAGRAM

in UML 2.0 in UML 2.0

Veronica CarregaVeronica Carrega

Page 2: Component Diagram

PLAN OF TALKPLAN OF TALK

Introduction about componentsIntroduction about components Components and component diagrams in uml 2.0Components and component diagrams in uml 2.0 Case studyCase study Elements of the componentElements of the component Component view: black-box view and white-box viewComponent view: black-box view and white-box view Deployment diagramsDeployment diagrams

Page 3: Component Diagram

INTRODUCTIONINTRODUCTION UML component diagrams describe software UML component diagrams describe software

components and their dependencies to each otherscomponents and their dependencies to each others A component is an A component is an autonomousautonomous unit within a system unit within a system The components can be used to define software systems of The components can be used to define software systems of

arbitrary size and complexityarbitrary size and complexity UML component diagrams enable to model the high-level UML component diagrams enable to model the high-level

software components, and the interfaces to those componentssoftware components, and the interfaces to those components Important for component-based development (CBD)Important for component-based development (CBD) Component and subsystems can be flexibly REUSED and Component and subsystems can be flexibly REUSED and

REPLACEDREPLACED A dependency exists between two elements if changes to the A dependency exists between two elements if changes to the

definition of one element may cause changes to the otherdefinition of one element may cause changes to the other Component Diagrams are often referred to as “wiring Component Diagrams are often referred to as “wiring

diagrams”diagrams” The wiring of components can be represented on diagrams by The wiring of components can be represented on diagrams by

means of components and dependencies between themmeans of components and dependencies between them

Page 4: Component Diagram

INTRODUCTIONINTRODUCTIONAn Uml diagram classification:An Uml diagram classification:

Static Static Use case diagram, Class diagramUse case diagram, Class diagram

Dynamic Dynamic State diagram, Activity diagram, Sequence diagram, State diagram, Activity diagram, Sequence diagram,

Collaboration diagramCollaboration diagram ImplementationImplementation

Component diagram, Deployment diagramComponent diagram, Deployment diagram

UML components diagrams areUML components diagrams are Implementation diagrams:Implementation diagrams:

describe the different elements required for describe the different elements required for implementing a systemimplementing a system

Page 5: Component Diagram

INTRODUCTIONINTRODUCTION

Another classification:Another classification: Behavior diagramsBehavior diagrams

A type of diagram that depicts behavior of a systemA type of diagram that depicts behavior of a systemThis includes activity, state machine, and use case This includes activity, state machine, and use case diagrams, interaction diagrams diagrams, interaction diagrams

Interaction diagramsInteraction diagrams A subset of behavior diagrams which emphasize object A subset of behavior diagrams which emphasize object

interactions.  This includes collaboration, activity, interactions.  This includes collaboration, activity, sequence diagramssequence diagrams

Structure diagramsStructure diagrams A type of diagram that depicts the elements of a A type of diagram that depicts the elements of a

specification that are irrespective of time.  This includes specification that are irrespective of time.  This includes class, composite structure, component, deploymentclass, composite structure, component, deployment

UML components diagrams are UML components diagrams are structurestructure diagramsdiagrams

Page 6: Component Diagram

COMPONENT in UML 2.0COMPONENT in UML 2.0

Modular unit with well-defined interfaces Modular unit with well-defined interfaces that is replaceable within its environmentthat is replaceable within its environment

AutonomousAutonomous unit within a system unit within a system Has one or more provided and required Has one or more provided and required

interfacesinterfaces Its internals are hidden and inaccessibleIts internals are hidden and inaccessible A component is encapsulatedA component is encapsulated Its dependencies are designed such that Its dependencies are designed such that

it can be treated as independently as it can be treated as independently as possiblepossible

Page 7: Component Diagram

CASE STUDYCASE STUDY Development of an application collecting students’ Development of an application collecting students’

opinions about courses opinions about courses A student canA student can

ReadRead InsertInsert UpdateUpdate Make data permanent about the courses in its scheduleMake data permanent about the courses in its schedule

A professor can only see statistic elaboration of the A professor can only see statistic elaboration of the datadata

The student application must be installed in pc client The student application must be installed in pc client (sw1, sw2)(sw1, sw2)

The manager application must be installed in pc client The manager application must be installed in pc client (in the manager’s office)(in the manager’s office)

There is one or more servers with DataBase and There is one or more servers with DataBase and components for courses managementcomponents for courses management

Page 8: Component Diagram

COMPONENT NOTATIONCOMPONENT NOTATION A component is shown as a rectangle withA component is shown as a rectangle with

A keyword <<component>>A keyword <<component>>

Optionally, in the right hand corner Optionally, in the right hand corner a component icon can be displayeda component icon can be displayed

A component icon is a rectangle with A component icon is a rectangle with two smaller rectangles jutting out from two smaller rectangles jutting out from the left-hand sidethe left-hand side

This symbol is a visual stereotypeThis symbol is a visual stereotype The component nameThe component name

Components can be labelled with a stereotypeComponents can be labelled with a stereotype

there are a number of standard stereotypes there are a number of standard stereotypes ex: <<entity>>, <<subsystem>>ex: <<entity>>, <<subsystem>>

Page 9: Component Diagram

Component ELEMENTSComponent ELEMENTS A component can haveA component can have

InterfacesInterfacesAn interface represents a declaration of a set ofAn interface represents a declaration of a set ofoperations and obligationsoperations and obligations

Usage dependenciesUsage dependenciesA usage dependency is relationship which one elementA usage dependency is relationship which one elementrequires another element for its full implementationrequires another element for its full implementation

PortsPortsPort represents an interaction point between a Port represents an interaction point between a

componentcomponentand its environmentand its environment

Connectors Connectors Connect two componentsConnect two components Connect the external contract of a component to the Connect the external contract of a component to the

internal structureinternal structure

Page 10: Component Diagram

INTERFACEINTERFACE

A component defines its behaviour in terms of A component defines its behaviour in terms of provided and required interfaces provided and required interfaces

An interface An interface Is the definition of a collection of one or more Is the definition of a collection of one or more

operationsoperations Provides only the operations but not the Provides only the operations but not the

implementationimplementation Implementation is normally provided by a class/ Implementation is normally provided by a class/

componentcomponent In complex systems, the physical implementation is In complex systems, the physical implementation is

provided by a group of classes rather than a single provided by a group of classes rather than a single classclass

Page 11: Component Diagram

INTERFACEINTERFACE

May be shown using a rectangle May be shown using a rectangle symbol with a keyword symbol with a keyword <<interface>> preceding the <<interface>> preceding the namename

For displaying the full signature, For displaying the full signature, the interface rectangle can be the interface rectangle can be expanded to show detailsexpanded to show details

Can beCan be ProvidedProvided RequiredRequired

Page 12: Component Diagram

INTERFACEINTERFACE A provided interface A provided interface

Characterize services that the Characterize services that the component offers to its component offers to its environmentenvironment

Is modeled using a ball, labelled Is modeled using a ball, labelled with the name, attached by a with the name, attached by a solid line to the componentsolid line to the component

A required interface A required interface Characterize services that the component expects Characterize services that the component expects

from its environmentfrom its environment Is modeled using a socket, labelled with the name, Is modeled using a socket, labelled with the name,

attached by a solid line to the componentattached by a solid line to the component In UML 1.x were modeled using a dashed arrowIn UML 1.x were modeled using a dashed arrow

Page 13: Component Diagram

INTERFACEINTERFACE Where two components/classes provide and Where two components/classes provide and

require the same interface, these two notations require the same interface, these two notations may be combinedmay be combined

The ball-and-socket notation hint at that interface in The ball-and-socket notation hint at that interface in question serves to mediate interactions between the two question serves to mediate interactions between the two componentscomponents

If an interface is shown using the rectangle symbol, we If an interface is shown using the rectangle symbol, we can use an alternative notation, using dependency arrowscan use an alternative notation, using dependency arrows

Page 14: Component Diagram

INTERFACEINTERFACE

A component A component Specifies a CONTRACT of the services that it provides Specifies a CONTRACT of the services that it provides

to its clients and that it requires from others to its clients and that it requires from others components in terms of its provided and required components in terms of its provided and required interfacesinterfaces

Can be replacedCan be replaced The system can be extendedThe system can be extended

In a system context where there are multiple components In a system context where there are multiple components that require or provide a particular interface, a notation that require or provide a particular interface, a notation abstraction can be used that combines by joining abstraction can be used that combines by joining

the interfacesthe interfaces

Page 15: Component Diagram

DEPENDENCIESDEPENDENCIES

Usage Dependency Usage Dependency A usage dependency is relationship which one A usage dependency is relationship which one

element requires another element for its full element requires another element for its full implementationimplementation

Is a dependency in which the client requires Is a dependency in which the client requires the presence of the supplierthe presence of the supplier

Is shown as dashed arrow with a <<use>> Is shown as dashed arrow with a <<use>> keywordkeyword

The arrowhead point from the dependent The arrowhead point from the dependent component to the one of which it is dependentcomponent to the one of which it is dependent

Components can be Components can be connected by usage connected by usage dependenciesdependencies

Page 16: Component Diagram

PORTPORT

Is shown as a small square symbolIs shown as a small square symbol Ports can be named, and the name Ports can be named, and the name

is placed near the square symbolis placed near the square symbol Is associated with the interfaces Is associated with the interfaces

that specify the nature of the that specify the nature of the interactions that may occur over a interactions that may occur over a portport

Specifies a distinct interaction pointSpecifies a distinct interaction point Between that component and its environmentBetween that component and its environment Between that component and its internal partsBetween that component and its internal parts

Page 17: Component Diagram

PORTPORT Ports can support unidirectional communication Ports can support unidirectional communication

or bi-directional communicationor bi-directional communication

If there are multiple If there are multiple interfaces associated interfaces associated with a port, these with a port, these interfaces may be listed interfaces may be listed with the interface icon, with the interface icon, separated by a commasseparated by a commas

Page 18: Component Diagram

PORTPORT

All interactions of a component with its All interactions of a component with its environment are achieved through a portenvironment are achieved through a port

The internals are fully isolated from the The internals are fully isolated from the environmentenvironment

This allows such a component to be used in This allows such a component to be used in any context that satisfies the constraints any context that satisfies the constraints specified by its portsspecified by its ports

Ports are not defined in UML 1.xPorts are not defined in UML 1.x

Page 19: Component Diagram

EXTERNAL VIEWEXTERNAL VIEW

An external view (or black box An external view (or black box view) shows publicly visible view) shows publicly visible properties and operationsproperties and operations

An external view of a component An external view of a component is by means of interface symbols is by means of interface symbols sticking out of the component sticking out of the component boxbox

The interface can be listed in the The interface can be listed in the compartment of a component boxcompartment of a component box

A component have an external view and an A component have an external view and an internal viewinternal view

Page 20: Component Diagram

INTERNAL VIEWINTERNAL VIEW

An internal, or white box An internal, or white box view of a component is view of a component is where the realizing where the realizing classes/components are classes/components are nested within the nested within the component shapecomponent shape

Realization is a relationship between two set Realization is a relationship between two set of model elementsof model elements One represents a specificationOne represents a specification The other represent an implementation of The other represent an implementation of

the latterthe latter

Page 21: Component Diagram

INTERNAL VIEWINTERNAL VIEW

The internal class that realize the The internal class that realize the behavior of a component may be behavior of a component may be displayed in an additional displayed in an additional compartmentcompartment

Compartments can also be used to Compartments can also be used to display parts, connectors or display parts, connectors or implementation artifactsimplementation artifacts

An artifact is the specification of a An artifact is the specification of a phisycal piece of informationphisycal piece of information

Page 22: Component Diagram

INTERNAL VIEWINTERNAL VIEW

Components can be built recursivelyComponents can be built recursively

Page 23: Component Diagram

ASSEMBLYASSEMBLY Two kinds of connectors:Two kinds of connectors:

DelegationDelegation AssemblyAssembly

ASSEMBLY CONNECTORASSEMBLY CONNECTOR A connector between 2 components defines that A connector between 2 components defines that

one component provides the services that one component provides the services that another component requiresanother component requires

He must only be defined from a required He must only be defined from a required interface to a provided interfaceinterface to a provided interface

An assembly connector is notated by a “ball-An assembly connector is notated by a “ball-and-socket” connectionand-socket” connection

This notation allows This notation allows for succint graficalfor succint grafical

wiring of componentswiring of components

Page 24: Component Diagram

SEMANTICSSEMANTICS

The semantics for an assembly connector :The semantics for an assembly connector : Are that signals travel along an instance of a Are that signals travel along an instance of a

connector originating in a required port and connector originating in a required port and delivered to a provided portdelivered to a provided port

The interfaces provided and required must be The interfaces provided and required must be compatiblecompatible

The interface compatibility between provided and The interface compatibility between provided and required ports that are connected enables an required ports that are connected enables an existing component in a system to be replacedexisting component in a system to be replaced

Page 25: Component Diagram

SEMANTICSSEMANTICS Multiple connections directed from a single required Multiple connections directed from a single required

interface to provided interfaces indicates that the interface to provided interfaces indicates that the instance that will handle the signal will be instance that will handle the signal will be determined at execution timedetermined at execution time

Page 26: Component Diagram

DELEGATIONDELEGATION DELEGATION CONNECTORDELEGATION CONNECTOR

Links the external contract of a component to Links the external contract of a component to the internal realizationthe internal realization

Represents the forwarding of signalsRepresents the forwarding of signals He must only be defined between used He must only be defined between used

interfaces or ports of the same kindinterfaces or ports of the same kind

Page 27: Component Diagram

DELEGATIONDELEGATION The target interface must support a signature compatible The target interface must support a signature compatible

with a subset of operations of the source interfacewith a subset of operations of the source interface A port may delegate to a set of ports on subordinate A port may delegate to a set of ports on subordinate

componentscomponents The union of the target interfaces must be signature The union of the target interfaces must be signature

compatible with the source interfacecompatible with the source interface Semantics: Semantics:

Is a declaration that behaviour that is available on a Is a declaration that behaviour that is available on a component instance is not realized by that component component instance is not realized by that component itself, but by another instance that has compatible itself, but by another instance that has compatible capabilitiescapabilities

Is used to model the hierarchical decomposition Is used to model the hierarchical decomposition Message and signal flow will occur between the Message and signal flow will occur between the

connected portsconnected ports

Page 28: Component Diagram

CASE STUDYCASE STUDY

Page 29: Component Diagram

CASE STUDYCASE STUDY

Page 30: Component Diagram

DEPLOYMENT DIAGRAMSDEPLOYMENT DIAGRAMS

Deployment diagramsDeployment diagrams Show the physical relationship between Show the physical relationship between

hardware and software in a systemhardware and software in a system Hardware elements:Hardware elements:

Computers (clients, servers)Computers (clients, servers) Embedded processorsEmbedded processors Devices (sensors, peripherals)Devices (sensors, peripherals)

Are used to show the nodes where software Are used to show the nodes where software components reside in the run-time systemcomponents reside in the run-time system

There is a strong link between components diagrams There is a strong link between components diagrams and deployment diagramsand deployment diagrams

Page 31: Component Diagram

DEPLOYMENT DIAGRAMSDEPLOYMENT DIAGRAMS

  

Deployment diagram Deployment diagram Contains nodes and connectionsContains nodes and connections A node usually represent a piece of hardware A node usually represent a piece of hardware

in the systemin the system A connection depicts the A connection depicts the

communication path communication path used by the hardware to used by the hardware to communicate communicate

Usually indicates the Usually indicates the method such as TCP/IPmethod such as TCP/IP

Page 32: Component Diagram

DEPLOYMENT DIAGRAMSDEPLOYMENT DIAGRAMS

An artifactAn artifact Is the specification of a Is the specification of a

phisycal piece of phisycal piece of informationinformation

Ex: source files, binary Ex: source files, binary executable files, table executable files, table in a database system,in a database system,….….

An artifact defined by An artifact defined by the user represents a the user represents a concrete element in the concrete element in the physical worldphysical world

Deployment diagrams Deployment diagrams contain artifactcontain artifact

Page 33: Component Diagram

DEPLOYMENT DIAGRAMSDEPLOYMENT DIAGRAMS An artifact manifest one or more model elements An artifact manifest one or more model elements A <<manifestation>> is the concrete physical of A <<manifestation>> is the concrete physical of

one or more model elements by an artifactone or more model elements by an artifact This model element often is a componentThis model element often is a component

A manifestation is A manifestation is notated as a dashed notated as a dashed line with an openline with an open arrow-head labeled arrow-head labeled with the keyword with the keyword <<manifest>> <<manifest>>

Page 34: Component Diagram

DEPLOYMENT DIAGRAMSDEPLOYMENT DIAGRAMS

Page 35: Component Diagram

REFERENCIESREFERENCIES

UML 2.0 Superstructure SpecificationUML 2.0 Superstructure SpecificationAugust 2, 2003August 2, 2003

UML 2 SuperstructureUML 2 Superstructure Final Adopted SpecificationFinal Adopted Specificationwww.omg.org/cgi-bin/doc?ptc/2003-08-02www.omg.org/cgi-bin/doc?ptc/2003-08-02

The Diagrams of UML 2.0The Diagrams of UML 2.0by Scott W. Ambler, 2003-2004 by Scott W. Ambler, 2003-2004 www.agilemodeling.com/essays/umlDiagrams.htmwww.agilemodeling.com/essays/umlDiagrams.htm

UML overviewUML overviewBy Mandar Chitnis, Pravin Tiwari, & Lakshmi By Mandar Chitnis, Pravin Tiwari, & Lakshmi AnanthamurthyAnanthamurthy http://www.developer.com/design/article.php/http://www.developer.com/design/article.php/15538511553851