C4 Model vs UML: Pick the View That Answers the Question

Use a checkout example to distinguish C4 architecture levels from UML notation, with a downloadable model and a class diagram example.

2026-10-01•UXXU Team
C4 modelsoftware architectureC4 tools

Quick Summary

What you will work through

  • Use C4 levels to choose the scope of an architecture conversation.
  • Use a UML class diagram when the question is about an implementation contract.
  • Compare the container and class examples for the same payment dependency.

C4 and UML answer different parts of an architecture discussion. C4 organizes the level of abstraction: system context, containers, components and code. UML provides diagram notations for structure and behavior. A C4 Code view can use a UML class diagram, so choosing C4 does not require abandoning UML.

Start with a checkout question

If a product owner asks who processes payments, use a context view showing the commerce system and its external payment provider. A class diagram would hide the system boundary behind implementation detail.

If an engineer asks how checkout is deployed, use a container view for the web application, API and data store, followed by a supplementary deployment view for runtime instances. A C4 container means an application or data store; it does not imply Docker.

Trace the purchase path in this container model. Notice that understanding the payment dependency does not require knowing a class name.

Zoom in only when it changes a decision

Suppose a payment adapter must support two providers. A component view can show the order service depending on a payment adapter. A Code view can then show a PaymentGateway interface implemented by two classes. That is where a UML relationship such as realization carries useful meaning.

UML class example: OrderService depends on PaymentGateway, implemented by two provider adapters

The dotted realization arrows point from each adapter to the interface. The dependency from OrderService points to the interface rather than to one provider implementation. This view supports a discussion about substitutability; it does not establish runtime isolation or deployment topology.

A practical review exercise

Download the checkout C4 model and the class diagram SVG. Ask reviewers to answer three questions: who depends on the payment provider, which deployable owns checkout, and which class implements its payment contract. Use context, container and code views respectively. If the answer needs a legend explaining two abstraction levels at once, split the view.

Keep source-level details aligned with code and update them when the contract changes. Do not reproduce every class in architecture documentation. The official C4 guidance recommends using only the levels that add value; the UML specification defines the notation.

The UXXU C4 model tool supports connected views, including Code class diagrams. Learn the notation in the C4 educational hub.

Put the example to work

Explore a live model, then build your own connected C4 views. UXXU’s free plan includes 400 architecture items for one user.