|
Component Diagram
Component diagrams are used to model
physical aspects of a system.Component diagrams does not
describe the functionality of the system but it describes the
components used to make those functionalities.Component
diagrams can also be described as a static implementation view
of a system. Static implementation represents the organization
of the components at a particular moment.
A component diagram has a higher level of abstraction than
a Class Diagram - usually a component is implemented by one or
more classes (or objects) at runtime. They are building blocks
so a component can eventually encompass a large portion of a
system.
Above diagram demonstrates some
components and their inter-relationships. Assembly connectors
"link" the provided interfaces supplied by "Product" and
"Customer" to the required interfaces specified by "Order". A
dependency relationship maps a customer's associated account
details to the required interface; "Payment", indicated by
"Order".
Components are similar in practice to package diagrams, as
they define boundaries and are used to group elements into
logical structures. The difference between package diagrams
and component diagrams is that Component Diagrams offer a more
semantically rich grouping mechanism. With component diagrams
all of the model elements are private, whereas package
diagrams only display public items.
Representing Components:Components are represented as a
rectangular classifier with the keyword «component»;
optionally the component may be displayed as a rectangle with
a component icon in the right-hand upper corner.
Interfaces and Ports: Components may both
provide and require interfaces. An interface is the definition
of a collection of one or more methods, and zero or more
attributes, ideally one that defines a cohesive set of
behaviors. A provided interface is modeled using the lollipop
notation and a required interface is modeled using the socket
notation. A port is a feature of a classifier that specifies a
distinct interaction point between the classifier and its
environment. Ports are depicted as small squares on the sides
of classifiers.
Assembly Connector: The assembly connector
bridges a component’s required interface (Component1) with the
provided interface of another component (Component2); this
allows one component to provide the services that another
component requires.
Components with Ports: Using Ports
with component diagrams allows for a service or behavior to be
specified to its environment as well as a service or behavior
that a component requires. Ports may specify inputs and
outputs as they can operate bi-directionally. The following
diagram details a component with a port for online services
along with two provided interfaces order entry and tracking as
well as a required interface payment.
|