1942-Module 08 PPT
1942-Module 08 PPT
Chapter 8
2
Component Diagrams
• A software component is a modelled part of a system. Because it includes the software
implementation of one or more classes and a component resides in a computer. A component can
only provide interfaces to other components .
• In UML 1.x, tables, data files, executable, dynamic link libraries and documents are defined as
components.
• The modelers that are used to classify these types are known as deployment components,
execution components and work product components.
• A component defines a system’s functionality. Just like a component is the implementation of one
or more classes, an artefact is the implementation of a component.
• The components and their relationships can be modelled so that clients could picture the
structure and the functionality in the completed project developers have the foundation
structure to work upon technical writers providing documentation and help files can
understand the content of their writings.
• Developers are ready for reuse.
3
Components and Interfaces
• Along with components, their interfaces also have to be dealt with.
• An object hides its functions from other objects and from the outside world. This process is
referred as encapsulation or information-hiding.
• The object has to present some information to its users. This presentation is called the object’s
interface.
• Reviewing Interfaces
1. An interface is a set of operations that allows the user to access a class’s behavior like the control knob, which enables
the user to get a washing machine to the working state. In all, the interface is a set of operations that a class presents to
other classes.
2. An interface can be conceptual or physical in nature. The interface that a class uses is same as the interface, a
component uses.
5
<<Component>>
tools::Calculator
Calculator
<<Component>> <<Component>>
Calculator Calculator
add()
subtract()
multiply()
Component icon divide()
6
Representing Interfaces
• A component and the interfaces it understand can be presented in two ways.
• The first defines the interface as a rectangle that contains interface-related information.
• It is interlinked to the component through a dashed line as well as a large open triangle that
indicate realization.
<<Interface>>
Key
<<Component>>
Calculator
state Changed()
7
Representing Interfaces
Key
<<Component>>
Calculator
8
Two way of showing dependency and realization in the same
diagram
<<Interface>>
Key
<<Component>> <<component>>
Robot
Calculator
state Changed()
9
Two way of showing dependency and realization in the same
diagram
<<component>>
<<Component>> Robot
Calculator
10
Boxes—Black and White
• When component interfaces gets modelled as depicted in figure 8.6, the user
could show what UML calls an external, or “black box,” view.
• An internal, or “white box,” view can also be shown.
• This view defines interfaces mentioned inside the component icon and
organized by keywords. Figure below depicts a white box view of the
components in figure.
<<Component>> Robot
11
Applying Component Diagrams
12
Deployment Diagram
• The packages that supply the Java elements
being used in the program.
• In the diagram , awt means “abstract
windowing toolkit,” a group of components
which display and control a graphic user
interface.
• The components used for this program are
Color that displays the color, Grid Layout
and Flow Layout that arrange the elements in
the GUI and Graphics and Graphics2D that
paint the GUI
• The name specified on the tab of the other major
package, swings, is a group of components that
the user could add to a graphic user interface.
• The names given to the components in the
package in the above diagram are quite self-
explanatory. JFrame is a frame, JSlider is a
slider, JPanel is a panel and JLabel is a label.
The package that is labelled as swing. Event,
makes the Change Listener interface available.
• This interface awaits the change in the state to 13
happen in the GUI.
Deployment Diagrams in the Big Picture
14
Communication Diagram
15
Deployment Diagram
• A deployment diagram defines the method in which artefacts are
deployed on system hardware, and the way in which pieces of
hardware connect to one another.
• The important hardware item in this case, is a node. Node is a
generic name for a computing resource.
• In UML 1.x, most of the modelers have distinguished between
two kinds of nodes viz., a processor, which executes a
component and a device that is a peripheral piece of hardware,
which does not execute components but interfaces indirectly with
the outside world.
• UML 2.0 defines a device as a node that executes artefacts. In
UML 2.0, a node is represented by a cube.
• A name is designated for the node, and the keyword «Device» is
added.
16
Three ways to model the artefacts deployed on
a node
17
Representing the connection between nodes
• A line that joins two cubes signifies a
connection between two nodes.
18
Representing a deployment specification
19
Modelling a home system
• While modelling a home system, the devices and the node symbols are used to represent peripherals. In UML 2.0, a node
represents a piece of hardware, which can compute.
• Since the systems involve peripherals, peripherals also have to be included in models.
• While distinguishing peripherals from devices, «peripheral» has to be added to every non normative node. The non normative
node’s name can itself supply all the information about the node.
• The cloud represents the internet and the lightning bolt represents a wireless connection.
20
21
Summary
• A communication diagram defines the interaction of objects through messages. The communication diagrams
are more useful when the links are more important for the development process.
• A sequence diagram is meant for creating the sequence of the messages. The sequence diagrams are used
when the sequence of calls is needed for the development.
Components diagrams are kind of the diagrams that depict the physical architecture of the system software.
Components diagram helps in demonstrating the method in which the programming code is divided into various
components as well as the dependencies between those components.
• A deployment diagram defines the method in which artifacts are deployed on system hardware, and the way in
which pieces of hardware connect to one another.
22
Thank You
23