SDA - Lab 4 - 2k23
SDA - Lab 4 - 2k23
Laboratory # 04
2/10/2025
UET TAXILA
Engr. Sidra Shafi
All UML diagrams can be useful to describe aspects of the architectural model. Four UML
diagrams are particularly suitable for architecture modeling:
• Package diagrams
• Subsystem diagrams
• Component diagrams
• Deployment diagrams
Component Diagram:
Component: A component represents a modular part of a system that encapsulates its contents
and whose manifestation is replaceable within its environment. In UML 2, a component is drawn
as a rectangle with optional compartments stacked vertically.
Component Diagram shows a set of components and their relationships that illustrates the static
implementation view of a system.
UML Component diagrams are used in modeling the physical aspects of object-oriented systems
that are used for visualizing, specifying, and documenting component-based systems and also for
constructing executable systems through forward and reverse engineering. Component diagrams
are essentially class diagrams that focus on a system's components that often used to model the
static implementation view of a system.
This type of diagram is used for Component-Based Development (CBD), to describe systems
with Service-Oriented Architecture (SOA).
A component diagram breaks down the actual system under development into various high levels
of functionality. Each component is responsible for one clear aim within the entire system and
only interacts with other essential elements on a need-to-know basis.
• The data (account and inspection ID) flows into the component via the port on the right-
hand side and is converted into a format the internal components can use. The interfaces
on the right are known as required interfaces, which represents the services the component
needed in order to carry out its duty.
Interface:
The example below shows two type of component interfaces:
Provided interface symbols with a complete circle at their end represent an interface that the
component provides - this "lollipop" symbol is shorthand for a realization relationship of an
interface classifier.
Required Interface symbols with only a half circle at their end (a.k.a. sockets) represent an
interface that the component requires (in both cases, the interface's name is placed near the
interface symbol itself).
Subsystems:
The subsystem classifier is a specialized version of a component classifier. Because of this, the
subsystem notation element inherits all the same rules as the component notation element. The
only difference is that a subsystem notation element has the keyword of subsystem instead of
component.
Port:
Ports are represented using a square along the edge of the system or a component. A port is often
used to help expose required and provided interfaces of a component.
Component diagrams commonly contain components, interfaces and dependency, association, and
realization relationships. It may also contain notes and constraints.
• Association
• Realization
• Constraint
• Dependency
• Links
• Either by forward or reverse engineering, identify the set of source code files of interest
and model them as components stereotyped as files.
• For larger systems, use packages to show groups of source code files.
• Model the compilation dependencies among these files using dependencies. Again, use
tools to help generate and manage these dependencies.
Examples:
• Identify the set of components you'd like to model. Typically, this will involve some or all
the components that live on one node, or the distribution of these sets of components across
all the nodes in the system.
• Consider the stereotype of each component in this set. For most systems, you'll find a small
number of different kinds of components (such as executables, libraries, tables, files, and
documents). You can use the UML's extensibility mechanisms to provide visual
cues(clues) for these stereotypes.
• For each component in this set, consider its relationship to its neighbors. Most often, this
will involve interfaces that are exported (realized) by certain components and then
imported (used) by others. If you want to expose the seams in your system, model these
interfaces explicitly. If you want your model at a higher level of abstraction, elide these
relationships by showing only dependencies among the components.
• Identify the classes in your model that represent your logical database schema.
• Package
• Interface
• Component
• ComponentInstance
• Artifact
• Port
• Part
• Association
• Dependency
• Realization
• Link
• Connector
A package is a grouping of model elements. Packages themselves may be nested within other
packages. A package may contain subordinate packages as well as other kinds of model elements.
All kinds of UML model elements can be organized into packages.
Component:
A component represents a modular, deployable, and replaceable part of a system that encapsulates
implementation and exposes a set of interfaces.
3. At the [Residents] tab of the [collection editor], you can add resident element by
using button.
2. And click the component where the port will be contained in the [main window].
3. A port is created on the component. At the quick dialog, enter the port name and
press [Enter] ken to be complete.
You can create port by dragging port from [model explorer] to main diagram.
1. Drag port in the [model explorer] and drop on the component in the main diagram.
2. A port appears on the component. If it is not dropped on the component but on the other
area of the diagram, component with port will be created
Part:
2. Drag from one part and drop to the other part in the [main window].
2. And click at the position where ComponentInstance will be placed in the [main
window].
3. Enter the component instance name at the quick dialog and press [Enter] key. The result
is as follows.
Artifact:
2. And click at the position where Artifact will be placed in the [main window].
3. The artifact is created on the diagram and the quick dialog is shown. At the quick dialog,
enter the artifact name
Association
Steps for creating association
2. Drag from one associated and drop to another in the [main window].
Dependency
Steps for creating dependency
Link
Steps for creating link:
Draw a Componet Diagram for an online shopping system. The component diagram must
contain webstore, warehouse and accounting components stereotyped as Subsystems.
dependencies.
*****************