Mastering C4 + Supplementary Diagrams with VPasCode: An Agile EA Guide

Read this post in:

Mastering C4 + Supplementary Diagrams with VPasCode: An Agile EA Guide

In the fast-paced world of Agile Enterprise Architecture, documentation often becomes a bottleneck. Teams struggle to capture not just what the system is, but how it behaves, where it runs, and how data flows. The solution lies in a pragmatic approach: leveraging the C4 model for structural clarity while supplementing it with specialized diagrams for dynamic behavior and deep-dive technical details. This tutorial explores how to implement this hybrid strategy using Visual Paradigm’s VPasCode, embracing the “Diagrams as Code” philosophy to ensure your architecture documentation remains version-controlled, maintainable, and AI-assisted.

The Philosophy: C4 as the Foundation, Supplementary Views as the Detail

The C4 model is renowned for its simplicity, focusing on four levels of abstraction: System Context, Containers, Components, and Code. It provides a “static structure” view—answering questions about what the system contains and how its parts relate. However, static structure often leaves critical questions unanswered. How do systems interact over time? What are the data relationships? Where does the software physically run?

To address these gaps, the C4 methodology explicitly supports a set of supplementary diagram types. These are not meant to replace C4 but to augment it. The golden rule is simple: Start with the question, not the notation.

  • How do systems fit together? Use a System Landscape diagram.
  • How do elements collaborate? Use a Dynamic diagram.
  • What is the message order? Use a UML Sequence diagram.
  • What is the workflow logic? Use a UML Activity diagram.
  • How is data persisted? Use an Entity-Relationship (ER) diagram.

Getting Started: VPasCode and Diagrams as Code

Visual Paradigm’s VPasCode is a browser-based workspace that transforms how teams create and maintain these diagrams. Instead of manually dragging boxes and arrows in a GUI, teams write code (specifically PlantUML) to generate diagrams. This “Diagrams as Code” approach offers three distinct advantages:

  1. Version Control Friendly: Text files can be tracked in Git, allowing for precise diffs, rollbacks, and collaborative editing.
  2. AI-Assisted Drafting: AI tools can generate initial drafts of code, which developers then refine.
  3. Consistency: It enforces naming conventions and structural rules automatically.

Step 1: Defining the Scope and Landscape

Before diving into the code, you must define the scope. A System Landscape diagram provides a high-level view of multiple software systems within an organization. It is the entry point for understanding the broader context.

When drafting a landscape diagram, you should define boundaries clearly. For example, if you are modeling an “Online Shop,” you might include internal systems like the “Customer Identity” service and external dependencies like a “Payment Provider.”

Here is how you might structure the code for a landscape view using PlantUML syntax:

@startuml
!include https://static.visual-paradigm.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
LAYOUT_LEFT_RIGHT()
LAYOUT_WITH_LEGEND()
skinparam vpDiagramType C4modelSystemLandscapeDiagram

title System Landscape diagram for Online Shop

Person(customer, "Customer", "Browses the shop and places orders")
Person(agent, "Support Agent", "Handles customer requests")

Boundary(shopBoundary, "Online Shop") {
  System(shop, "Online Shop", "Web shop front end and order management")
}

System_Ext(identity, "Customer Identity", "Customer authentication and profiles")
System_Ext(payment, "Payment Provider", "Authorizes payment transactions")
System_Ext(wms, "Warehouse Management", "Handles fulfilment of orders")
System_Ext(email, "Email Service", "Sends transactional notifications")

Rel(customer, shop, "Browses and places orders", "HTTPS")
Rel(agent, shop, "Handles customer requests", "HTTPS")
Rel(shop, identity, "Authenticates customers", "HTTPS/JSON")
Rel(shop, payment, "Authorizes payments", "HTTPS/JSON")
Rel(shop, wms, "Sends fulfilment requests", "HTTPS/JSON")
Rel(shop, email, "Sends notifications", "HTTPS/JSON")
@enduml

Step 2: Modeling Dynamic Interactions

Once the static structure is defined, you need to understand the runtime behavior. The C4 Dynamic Diagram is the go-to for showing how elements collaborate to complete a use case. It is a simplified communication diagram that avoids the vertical timeline of a sequence diagram but still captures the essence of interaction.

For a “Place Order” scenario, you would identify the participants (Customer, Web App, Orders API, Payment Adapter, Database) and the sequence of messages. This diagram is best used when you want to show the broad sequence of collaboration without getting bogged down in the exact timing of every single message.

Step 3: Deep Dives with UML Sequence and Activity Diagrams

When the dynamic diagram is too abstract, you must drill down. The UML Sequence Diagram is the standard for tracing message order over time. It is indispensable when your question involves “What happens if the payment fails?” or “How are retries handled?”

Consider a checkout sequence where the system must handle both approved and declined payments. You would use alt (alternative) and else blocks to model the branching logic clearly.

title Online Shop — Checkout Sequence
actor Customer
participant "Web App" as Web
participant "Orders API" as Orders
participant "Payment Adapter" as Payments
participant "Payment Provider" as Provider
database "Orders DB" as DB

Customer -> Web : Submit checkout
Web -> Orders : createOrder(cart)
Orders -> Payments : authorize(amount)
Payments -> Provider : authorize(amount)
Provider --> Payments : authorization result

alt Payment approved
    Payments --> Orders : approved
    Orders -> DB : save(order, CONFIRMED)
    DB --> Orders : saved
    Orders --> Web : confirmation
    Web --> Customer : Show confirmation
else Payment declined
    Payments --> Orders : declined
    Orders -> DB : save(order, PAYMENT_FAILED)
    Orders --> Web : payment issue
    Web --> Customer : Show payment issue
end

Alternatively, if your focus is on the workflow logic rather than message exchange, a UML Activity Diagram is more appropriate. This is ideal for business processes, such as “Order Fulfilment,” where you need to visualize decision diamonds (e.g., “Is inventory available?”) and parallel paths.

Step 4: Data Modeling with ER Diagrams

Finally, no architecture is complete without understanding the data. While C4 can show that a database exists, it cannot show how the data is related. An Entity-Relationship (ER) Diagram is essential here. It focuses on persisted data, tables, keys (Primary and Foreign), and relationships.

In VPasCode, you can define entities and their keys explicitly. This ensures that your developers and DBAs have a clear, unambiguous view of the schema.

title Online Shop — Order Data Model
hide circle
skinparam linetype ortho

entity "CUSTOMER" as Customer {
  * customer_id : UUID <>
  --
  email : VARCHAR
}

entity "ORDERS" as Orders {
  * order_id : UUID <>
  --
  customer_id : UUID <>
  status : VARCHAR
  created_at : TIMESTAMP
}

entity "ORDER_LINE" as Line {
  * order_id : UUID <>
  * line_no : INTEGER <>
  --
  product_id : UUID <>
  quantity : INTEGER
  unit_price : DECIMAL
}

Customer ||--o{ Orders : places
Orders ||--|{ Line : contains

The Agile EA Workflow: Review and Maintain

Creating these diagrams is only half the battle. To be effective in an Agile environment, your documentation must be maintained. Use the following checklist before publishing any supplementary diagram:

  • Purpose: Does the title clearly state the question being answered?
  • Scope: Is the system, environment, or scenario clearly identified?
  • Consistency: Do the names match the C4 views (e.g., “Web App” vs. “Web Application”)?
  • Abstraction: Is it clear if this is a domain model, code model, or database schema?
  • Readability: Can a new team member follow the flow without a dense tangle of elements?

By combining the structural clarity of C4 with the behavioral depth of UML and ER diagrams, and managing them all through VPasCode, Agile Enterprise Architecture teams can create living documentation that evolves with their software.