Search code examples
umlmodelingdiagramc4-model

C4 model in practice


After reading about C4 model and listening Simon Brown's talk I still don't understand how to use it in practice.

AFAIK, the main contribution of C4 model is "agreement" on simple abstraction that brings diagrams and documentation closer to developers. In the same C4 is more about advice, and you have to figure out some stuff by yourself (which breaks an "agreement" with custom abstractions again).

What should I do in case C4 lacks details? Till which degree I should customize it?

For example:

  1. How supporting diagrams like Infrastructure, Data Flow or Business process fit into C4?
    For example, are routers/firewalls/api-gateways/service-buses a C4's Containers at Infrastructure diagram? I couldn't find any example.
  2. Is that a good idea to extend C4's levels?
    C4 model has only 4 level (isn't recursive). What if I need the 5th subsystem level.
  3. Should "Database Container" at container diagram (level 2) contain information about about database name, schema name or database technology?
    From examples, doesn't contain, ro does contain.
  4. Is that possible to find C4 examples besides trivial from the official doc?

Solution

    1. How supporting diagrams like Infrastructure, Data Flow or Business process fit into C4? For example, are routers/firewalls/api-gateways/service-buses a C4's Containers at Infrastructure diagram? I couldn't find any example.

    The core diagrams that make up the C4 model are designed to focus on static structure, at different levels of detail. There are also some supplementary diagrams defined at c4model.com, one of which is a deployment diagram ... this is where I would model routers, firewalls, load balancers, etc.

    There are several other diagramming notations that can be used for data flow (DFDs, UML sequence diagrams, UML collaboration/communication diagrams, etc) and business processes (BPMN, ArchiMate, UML activity diagrams, etc). Rather than reinventing the wheel, my recommendation is that teams use these existing diagrams/notations to supplement their C4 model diagrams as needed.

    From the c4model.com FAQ: "The focus of the C4 model is the static structures that make up a software system, at different levels of abstraction. If you need to describe other aspects, feel free to supplement the C4 diagrams with UML diagrams, BPML diagrams, ArchiMate diagrams, entity relationship diagrams, etc."

    1. Is that a good idea to extend C4's levels? C4 model has only 4 level (isn't recursive). What if I need the 5th subsystem level.

    Sure, I've seen teams do this. Just ensure that your "extension" is documented and understood by everybody in your team/organisation.

    1. Should "Database Container" at container diagram (level 2) contain information about about database name, schema name or database technology? From examples, doesn't contain, ro does contain.

    It's up to you. If your database is a standard RDBMS database/schema, and doesn't make use of any proprietary features, then you don't necessarily need to specify the technology. Instead you could mention the technology on a deployment diagram. But if your database is using specific features of the RDBMS (e.g. Oracle stored procedures), and can't be deployed onto a different RDBMS, then you may as well specify the technology to make that clear.

    1. Is that possible to find C4 examples besides trivial from the official doc?

    Public examples are hard to come by unfortunately ... that's just the nature of organisations not wanting to make their documentation public. A search for "c4 model" on GitHub should find you some examples.