Wize Software Engineering Textbook > Object-Oriented Modelling

Package, Component, and Deployment Diagrams

Reading Component Diagrams Through Interface Contracts

Component diagrams help you reason about software as collaborating units with explicit boundaries. In UML, a component is a modular unit that encapsulates its contents and can be replaced within its environment when the relevant contracts remain satisfied. Use component diagrams to discuss responsibilities, service requirements, and connections without exposing every implementation detail.

Read the boundary before the implementation

An interface specifies a contract through which a component interacts with its environment. That contract includes available operations and their meaning, rather than just a list of names. It can specify parameter types, units, permitted inputs, results, and failure behavior.


A component is commonly drawn as a rectangle marked «component», or with the component icon. Its name should identify a coherent responsibility, such as Catalogue or PaymentProcessing. One component can contain several implementation classes; the diagram does not imply one component per class.


Read each interface from the perspective of its owning component:


Interface role

Meaning at the component boundary

Compact notation

Provided

The component offers the specified services

A small circle attached by a line, often called a lollipop

Required

The component needs the specified services from its environment

An open semicircle, often called a socket


An interface can be provided by one component and required by another. Its role depends on the component you are examining, not on the interface name.



Distinguish dependence from connection

An assembly connector wires a required interface to a compatible provided interface in a configuration. In the compact notation, the ball and socket meet. The connection expresses how a service requirement is supplied; it is not a timeline of calls.


A usage dependency is drawn as a dashed line with an open arrowhead, usually marked «use». It points from the dependent client toward the supplier. It states that the client needs the supplier for its implementation or operation. An overview dependency does not, by itself, identify the detailed interface wiring.


SearchPage and Catalogue are shown using an assembly connection above and a usage dependency below.


Example: SearchPage requires Lookup, and Catalogue provides Lookup. An assembly can show that this particular requirement is connected to Catalogue's offer. A simpler usage arrow from SearchPage to Catalogue records dependence while leaving the connection details unspecified.


A port, drawn as a small boundary square, can group interactions. When internal structure is shown, a delegation connector can route an interaction at an outer port to an internal part. This describes responsibility across a boundary rather than a call sequence.



Check completeness and replacement claims

For a simple completeness audit, count required endpoints: each separate occurrence of a requirement on a component. Two components requiring Lookup contribute two endpoints, even though the interface name is repeated. If each endpoint needs one compatible selected provider, use:


Nunmatched=Nrequired−Nmatched.N_{\text{unmatched}}=N_{\text{required}}-N_{\text{matched}}.


Here, matched means that a compatible provider has actually been selected for that endpoint. An unattached socket might intentionally represent a service supplied by an external environment, so interpret it using the stated diagram scope. The count checks modeled connections; it does not measure reliability or performance.


Replacement requires compatible behavior as well as compatible operation signatures. A new provider that interprets an amount in cents rather than dollars can violate the contract despite using the same operation name. Also inspect its required interfaces: an otherwise compatible replacement may introduce a service the environment does not supply.


A component diagram alone does not establish execution order, response time, or successful behavior under every input. Those claims need additional specifications or evidence.


What to remember

  • Identify each component's offers and needs separately.
  • Distinguish a usage dependency from selected assembly wiring.
  • Count required endpoints rather than distinct interface names.
  • Check behavioral contracts and external requirements before accepting a replacement.

Example: Auditing a Ticket Booking Design

Example: A theatre is reviewing the component diagrams for its ticket-booking application. An interface contract specifies the operations and behavioral conditions a component offers or expects. The contract inventory for this design is:


Component

Required interfaces

Provided interfaces

Booking

SeatLookup, Charge, AuditWrite

Reservation

SeatStore

None in this model

SeatLookup

Billing

None in this model

Charge


Booking has usage dependencies toward SeatStore and Billing.


The team has selected two compatible assembly bindings: Booking's SeatLookup requirement to SeatStore's offer, and Booking's Charge requirement to Billing's offer. No provider has been selected for AuditWrite. Each required endpoint needs exactly one compatible provider. Count only the interfaces listed here.


(a) Identify the owners of the required sockets and provided circles for the two selected bindings. Explain what the dashed arrows establish.


For SeatLookup, the socket belongs to Booking because Booking needs the service. The circle belongs to SeatStore because SeatStore offers it. For Charge, the socket again belongs to Booking, while the circle belongs to Billing.


The arrows point from Booking toward the suppliers it uses. They establish usage dependencies; they do not themselves show the detailed assembly endpoints. The problem text supplies the selected bindings.


Answer: Booking owns both required sockets; SeatStore provides SeatLookup, and Billing provides Charge. The dashed arrows record Booking's dependence on those suppliers.


(b) Calculate how many required endpoints remain unmatched before any replacement.


First count Booking's service requirements. SeatLookup, Charge, and AuditWrite give a required total of ________. SeatStore and Billing have no required interfaces within the stated model, so they add nothing to that total.


Next count the selected compatible bindings. SeatLookup and Charge give a matched total of ________. A usage arrow is not an extra binding and should not be counted again.


Nunmatched=Nrequired−Nmatched=3−2=1 endpoint.N_{\text{unmatched}}=N_{\text{required}}-N_{\text{matched}}=3-2=1\ \text{endpoint}.


Answer: One required endpoint remains unmatched: Booking's AuditWrite requirement.


(c) BillingPlus preserves Billing's complete Charge contract but additionally requires FraudCheck and ExchangeRate. Neither service is supplied by the environment. If BillingPlus replaces Billing and all existing bindings are preserved, calculate the total number of unmatched endpoints and decide whether all modeled requirements are satisfied.


The original AuditWrite requirement remains unmatched because replacing Billing does not supply it. The replacement adds a FraudCheck requirement contributing ________ and an ExchangeRate requirement contributing ________. Neither has a provider.


The replacement preserves the existing Charge contract, so that binding remains matched. SeatLookup also remains matched. The required total increases by two, while the matched total stays unchanged.


Nrequired,new=3+2=5 endpoints,Nmatched,new=2 endpoints,Nunmatched,new=5−2=3 endpoints.\begin{aligned} N_{\text{required,new}}&=3+2=5\ \text{endpoints},\\ N_{\text{matched,new}}&=2\ \text{endpoints},\\ N_{\text{unmatched,new}}&=5-2=3\ \text{endpoints}. \end{aligned}


Answer: Three endpoints remain unmatched: AuditWrite, FraudCheck, and ExchangeRate. All modeled requirements are therefore not satisfied. Preserving the offered Charge contract is insufficient when the replacement introduces requirements its environment cannot supply.

A payment application uses the component diagram shown below. Which statement correctly describes the roles of Ledger and Checkout at Posting?


Ledger and Checkout are connected through an interface named Posting.


Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A software model organizes billing records and support records into the packages shown. Shop has no enclosing named package. Each inner package owns its own element named Invoice.


The Shop package contains Billing and Support packages, each owning an element named Invoice.


Complete each full UML name, starting with Shop and separating names with two colons, without spaces.


The Invoice element owned by Billing is . The Invoice element owned by Support is .

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

You are reviewing a software architecture model. Match each component-diagram term to the description that captures its structural role.

Match each term
A.

A modular unit whose contents are encapsulated behind specified services

B.

A named interaction point on a unit boundary through which contracts may be exposed

C.

A contract for services a unit offers to its environment

D.

A link that wires a needed service to a compatible offer in a configuration

E.

A contract for services a unit expects its environment to supply

Provided interface

Assembly connector

Required interface

Port

Component

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice