<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Slava Vedernikov on Medium]]></title>
        <description><![CDATA[Stories by Slava Vedernikov on Medium]]></description>
        <link>https://medium.com/@slava.vedernikov?source=rss-d945b694fa73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tcdzhdjRrYwgyo3a</url>
            <title>Stories by Slava Vedernikov on Medium</title>
            <link>https://medium.com/@slava.vedernikov?source=rss-d945b694fa73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 16:30:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@slava.vedernikov/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[C4 Diagrams vs Architecture Model with C4InterFlow]]></title>
            <link>https://medium.com/@slava.vedernikov/c4-diagrams-vs-architecture-model-with-c4interflow-d72223701d62?source=rss-d945b694fa73------2</link>
            <guid isPermaLink="false">https://medium.com/p/d72223701d62</guid>
            <category><![CDATA[c4-diagrams]]></category>
            <category><![CDATA[c4-model]]></category>
            <category><![CDATA[application-architecture]]></category>
            <category><![CDATA[diagrams-as-code]]></category>
            <category><![CDATA[architecture-as-code]]></category>
            <dc:creator><![CDATA[Slava Vedernikov]]></dc:creator>
            <pubDate>Sat, 19 Sep 2026 11:02:09 GMT</pubDate>
            <atom:updated>2026-09-19T16:06:13.574Z</atom:updated>
            <content:encoded><![CDATA[<p>Stop drawing architecture diagrams manually! Here is why…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ZiJWAmYZD9w7yfPHPIvbQ.png" /></figure><p>For years Application Architects and Engineers didn’t really have a choice when it came to visualising Application Architecture. So we got into a habit of drawing diagrams. What we are now seeing in most organisations is <strong>inconsistency</strong>, <strong>duplication</strong>, <strong>ambiguity </strong>and many more other issues with architecture documentation. I talk about it in great details in <a href="https://medium.com/@slava.vedernikov/9-problems-with-application-architecture-documentation-and-how-architecture-as-code-can-solve-them-f0650467e24c">9 Problems with Application Architecture Documentation</a>.</p><p>Today the choice is there, but are you making the <em>“right”</em> one..?</p><h3>Diagrams as Code</h3><p>With tools like <a href="https://github.com/plantuml-stdlib/C4-PlantUML">C4-PlantUML</a>, and <a href="https://mermaid.js.org/">Mermaid</a> your <a href="https://c4model.com/">C4 Model</a> architecture diagrams can now live in source/version control. They can now be maintained within your codebase. However, they are still just <strong>diagrams </strong>— static snapshots of your architecture from <strong>specific view points</strong>. You still need multiple of those to comprehensively describe you solution.</p><p>This approach inherits most <strong>diagramming </strong>issues, but it’s still a step in the right direction.</p><h3>AI generated diagrams</h3><p>With AI you can now describe your solution and AI will gladly generate whatever you ask for, which could be an image or a diagram in specific format (e.g. <a href="https://app.diagrams.net/">Draw.io</a>) or diagram as code etc. If you give it enough context, and if you are willing to go through a few iterations, the result can be quite good. I’ve looked at a few such tools in <a href="https://medium.com/@slava.vedernikov/why-stop-at-generating-architecture-diagrams-with-ai-how-about-a-full-architecture-model-7aa2ff6a72a6">Why stop at generating architecture diagrams with AI</a>.</p><p>However, it’s still just a <strong>diagram</strong>…</p><blockquote>BTW, I found that most AI generated content looks <em>“</em>impressive<em>”</em> at first until you look at the details, especially if you have a clear idea of what you actually want to achieve. So, good luck with that!</blockquote><h3>Architecture Modelling</h3><p>The power of Architecture Modelling is in what you can do with the model — generate <strong>multiple views</strong> automatically. You are no longer drawing or coding static diagrams, you ask a tool to generate any number of views/diagrams you want depending on the context — your <strong>audience</strong>, <strong>scope</strong>, <strong>scenario </strong>or <strong>use case</strong> you want to represent etc.</p><p>You can model <a href="https://c4model.tools/#visual-modelling-tools">visually</a> or in <a href="https://c4model.tools/#text-based-modelling-tools">code</a>. However, the kind of architecture model you get will vary depending on which tool you choose to model it.</p><p>Most tools out there choose to model using the <strong>relationships </strong>paradigm. So, when you model visually with such tools, you still <em>“draw”</em> a line between two boxes. It looks like you are drawing yet another diagram, but tools behind the scene create relashionships.</p><p>When you model in code, you express those <strong>relationships </strong>in different ways depending on tool’s DSL (Domain Specific Language).</p><p>In <a href="https://structurizr.com/">Structurizr</a> or in <a href="https://likec4.dev/">LikeC4</a> you may do something like</p><pre>MySystem.WebApp -&gt; MySystem.WebAPI &quot;Get Post Patch and Delete Resources&quot;</pre><p>In <a href="https://github.com/lonely-lockley/archinsight">Archinsight</a>, you may do something like</p><pre>component api_resources<br>        name = API resources<br>        technology = Quarkus REST<br>        responsibility = Exposes project, auth, repository, language, and render endpoints<br>        links:<br>            -&gt; auth_filter<br>            -&gt; repository_service<br>            -&gt; language_pipeline<br>            -&gt; render_fallback_client</pre><p>In <a href="https://github.com/finos/architecture-as-code">CALM </a>(Common Architecture Language Model by <a href="https://www.finos.org/">FINOS</a>, you may do something like</p><pre>&quot;relationships&quot;: [<br>    {<br>      &quot;unique-id&quot;: &quot;ai-engine-to-process-db&quot;,<br>      &quot;relationship-type&quot;: {<br>        &quot;connects&quot;: {<br>          &quot;source&quot;: {<br>            &quot;node&quot;: &quot;ai-fluxnova-engine&quot;<br>          },<br>          &quot;destination&quot;: {<br>            &quot;node&quot;: &quot;ai-fluxnova-process-db&quot;<br>          }<br>        }<br>      },<br>      &quot;protocol&quot;: &quot;JDBC&quot;,<br>      &quot;description&quot;: &quot;Engine persists AI agent process state, LLM interaction history, and audit data to the process database&quot;<br>    }]</pre><p>This is very similar (<em>although hugely simplified</em>) to how traditional Enterprise Architecture Modelling tools like <a href="https://www.sparxsystems.eu/enterprise-architect/partnerproducts/mdg-technology-for-c4/">Enterprise Architect</a> work. They are usually based on Architecture Frameworks like <a href="https://www.opengroup.org/togaf">TOGAF </a>or <a href="https://www.opengroup.org/archimate-forum/archimate-overview">ArchiMate</a>, which come with thier own <strong>metamodels </strong>describing all possible <strong>relationships </strong>that can be documented <strong>between </strong>various model <strong>entities</strong>.</p><blockquote>However, using simple <strong>relationships </strong>when modelling architecture is a <strong>mistake</strong>!</blockquote><p>Think about it, when we build software we don’t say in code</p><pre>public class ProductsController<br>{<br>    uses _repository<br>}</pre><p>We’d write something like</p><pre>public class ProductsController<br>{<br>    ...<br><br>    [HttpGet]<br>    public async Task&lt;ActionResult&lt;IEnumerable&lt;Product&gt;&gt;&gt; GetAll()<br>    {<br>        var products = await _repository.GetAllAsync();<br>        return Ok(products);<br>    }<br>}</pre><p>We are basically saying</p><p><strong>Products Controller </strong>&gt; <strong>Get All</strong> <em>interface </em><strong><em>USES </em>Product Repository</strong> &gt; <strong>Get All Async</strong> <em>interface</em>.</p><p>It looks like a relationship of type <strong>USES</strong>, right..? Yes, but the relationship is not between <strong>entities</strong>, it’s a relationship between their <strong>interfaces </strong>and that makes a <strong>HUGE </strong>difference.</p><blockquote>When we create <strong>relationships </strong>between <strong>entities</strong>, we describe <strong>DEPENDENCIES</strong>. When we create <strong>relationships </strong>between entity <strong>interfaces</strong>, we describe <strong>FLOWS</strong>.</blockquote><p>When you describe <strong>flows </strong>in your architecture model, you are enabling architecture visualisation by <strong>scenario </strong>or <strong>use case</strong> end-to-end. This is a lot more valuable story to tell to your stakeholders.</p><p>So why don’t we describe <strong>flows </strong>in Architecture Model..? Well, that was the “<strong><em>mistake</em></strong>”.</p><p>Creators of architecture modelling tools like <a href="https://structurizr.com/">Structurizr</a>, <a href="https://icepanel.io/">IcePanel</a> and <a href="https://github.com/finos/architecture-as-code">CALM</a> realised it, so they have all added <strong>flows </strong>feature to their tools. The problem with that is, you have to <strong>describe flows separately</strong> by either overlaying them on top of views or by creating separate dynamic views.</p><blockquote>As far as I’m aware at the moment of writing, <a href="https://www.c4interflow.com/">C4InterFlow</a> is the <strong>only </strong>Architecture Modelling tool that has <strong>Interfaces </strong>and <strong>Flows </strong>as first-class citezens of the <strong>Architecture Model</strong>.</blockquote><p>I talk about the power of <strong>Interfaces </strong>and <strong>Flows </strong>in <a href="https://medium.com/@slava.vedernikov/c4-model-interfaces-flows-architecture-as-code-b95b91cb32d9">C4 Model + Interfaces + Flows — it’s a GAME-CHANGER!</a></p><h3>So, why should you stop drawing architecture diagrams manually..?</h3><p>Well, that was a long intro… However, I hope that by now you are at least open to the idea of <strong>breaking the old habit of drawing diagrams</strong> and exploring Architecture Modelling. I haven’t drawn a single architecture diagram now for over three years, and I don’t miss it!</p><p>You may have some reservations… The pushbacks I’m hearing are <strong>learning curve</strong>, <strong>time </strong>required for modelling vs diagramming etc. So, what I wanted to do is to compare <strong>diagramming </strong>and <strong>modelling </strong>approaches on a specific example, which is often used to demonstrate C4 Model visualisation framework - <strong>Big Bank Plc</strong>.</p><p>I was looking to see how much <strong>time </strong>I spend, how <strong>easy </strong>or <strong>difficult </strong>each approach would feel, and what the <strong>results </strong>would be.</p><p>Here is the full video showing <strong>diagramming </strong>with <a href="https://app.diagrams.net/">Draw.io</a> vs <strong>modelling </strong>with <a href="https://app.c4interflow.com/">C4InterFlow App</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMIdOjconYnM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMIdOjconYnM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMIdOjconYnM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b258c785cacb2a3fb2e17bc42d15a01/href">https://medium.com/media/9b258c785cacb2a3fb2e17bc42d15a01/href</a></iframe><p>This quick test demonstrates that it takes <strong>about the same amount of time</strong> to draw a couple of static diagrams as it takes to build a complete architecture model. Well… In this experiment, surprisingly, modelling was actually a bit quicker. However, the <strong>results are so much different</strong>!</p><p>With <strong>Draw.io</strong> you get two static diagrams — <em>Software Context</em> and <em>Container</em>; and even with only two diagrams there were already some <strong>duplications</strong>.</p><p>With <strong>C4InterFlow </strong>you get:</p><ul><li><strong>Architecture Model </strong>— source of truth and no duplication</li><li><strong>Multiple Views</strong> (different <em>Scopes </em>and <em>Level of Detail</em>)</li><li>Different <strong>Diagram Types</strong> (C4, C4 Static, and C4 Sequence)</li><li>Native numbered <strong>Flows </strong>for each Scenario/Use Case</li><li>And much more…</li></ul><p>Don’t you think it’s time to learn how to model software architecture and create a single source of truth for your solution?</p><h3>Get started</h3><ul><li>Try <a href="https://playground.c4interflow.com/"><strong>C4InterFlow Playground</strong></a><strong> </strong>— load and explore C4InterFlow sample Architecture Models or create your own.</li><li>Try <a href="https://app.c4interflow.com/"><strong>C4InterFlow App</strong></a><strong> </strong>free — one repository, 100 interfaces, no credit card required.</li><li>Like it..? Star the<strong> </strong><a href="https://github.com/SlavaVedernikov/C4InterFlow"><strong>open-source framework on GitHub</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d72223701d62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why stop at generating architecture diagrams with AI — how about full Architecture Model?]]></title>
            <link>https://medium.com/@slava.vedernikov/why-stop-at-generating-architecture-diagrams-with-ai-how-about-a-full-architecture-model-7aa2ff6a72a6?source=rss-d945b694fa73------2</link>
            <guid isPermaLink="false">https://medium.com/p/7aa2ff6a72a6</guid>
            <category><![CDATA[c4-model]]></category>
            <category><![CDATA[c4-diagrams]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[architecture-as-code]]></category>
            <category><![CDATA[ai-generated-diagrams]]></category>
            <dc:creator><![CDATA[Slava Vedernikov]]></dc:creator>
            <pubDate>Mon, 29 Jun 2026 07:10:15 GMT</pubDate>
            <atom:updated>2026-07-05T08:17:27.074Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I’ve started seeing people sharing tools and skills that can be used to generated software architecture diagrams with AI from a single prompt. Here are just some of them: <a href="https://www.eraser.io/diagramgpt">Eraser’s DiagramGPT</a>, <a href="https://infrasketch.net/">InfraSketch</a>, <a href="https://github.com/Cocoon-AI/architecture-diagram-generator">Cocoon-AI — Architecture Diagram Generator</a>, <a href="https://github.com/Agents365-ai/drawio-skill">Agents365-AI — Drawio skill</a> etc.</p><p>Let’s try them out and see what the results will be.</p><p>Here is a pretty basic solution description that I’m going to use as a prompt to try all these tools:</p><blockquote>A customer-facing Health Insurance Quote and Enrolment web application that allows prospects to get a health insurance quote by providing basic personal information. The application sends the information to a Quote Engine, displays available plans and premiums, and saves both the Prospect and Quote records.</blockquote><blockquote>Once a quote is generated, the system stores the quote, creates or updates the Prospect record in CRM, and emails the quote to the prospect with a link to continue the application process.</blockquote><blockquote>If the prospect decides to proceed, they can return to the application, provide additional personal, health, eligibility, and payment information, and submit a policy application. The system validates the information, performs eligibility and underwriting checks, and submits the completed application to the Policy Administration System (PAS), which then creates and activates the policy</blockquote><blockquote>The solution updates the prospect/customer record, stores policy information, and sends confirmation notifications.</blockquote><h4>Eraser’s DiagramGPT</h4><p>Below is the diagram Eraser generated (after a few minutes of re-aligning boxes and lines by hand). Not bad…</p><figure><img alt="Eraser AI generated diagram" src="https://cdn-images-1.medium.com/max/1024/1*RYduKxFT1NlEaGLHvJDrXQ.png" /><figcaption>Eraser AI generated diagram</figcaption></figure><h4>InfraSketch</h4><p>Here is what InfraSketch came up with… Very high level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*gUdx4kiP_7p6DXU49c-VQg.png" /></figure><h4>Cocoon-AI — Architecture Diagram Generator</h4><p>Here is diagram generated by Cocoon-AI — Architecture Diagram Generator. Not very accurate and a bit confusing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CQsy-CLsHLBpnSlyGUVNQ.png" /></figure><h4>Agents365-AI — Drawio skill</h4><p>Here is a Draw.io diagram generated by AI using drawio skills.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kDxaKvnvkfBh0YMZARQdJw.png" /></figure><p>These diagrams may be somewhat acceptable as a first draft. I’ll let you be the judge of their quality… but honestly, I don’t think I’d use them when talking my engineering team through the solution design.</p><h3>Diagrams vs. Models — this distinction changed everything for me</h3><p>I spent years as a Solution and Application Architect manually drawing diagrams… Different views for different audiences, all maintained separately, all slowly drifting out of sync with reality.</p><p>At some point I realised: the problem isn’t so much how we <em>draw</em> diagrams. It’s that we’re thinking in diagrams at all.</p><p>An architecture <em>diagram</em> is a static picture. Boxes, arrows, labels — stored in Visio, Miro, or Draw.io etc. It looks great in PowerPoint deck, but it becomes irrelevant the moment your architecture evolves.</p><p>An architecture <em>model</em> <em>as code</em> is something completely different. It’s a structured, version-controllable definition of your system — the Software Systems, Containers, Components, Interfaces, and the Flows between them. Diagrams should be <em>generated from</em> the model, not drawn by hand.</p><p>Think of it like this: a diagram is a snapshot of your architecture from a particular viewpoint. A model is a blueprint. You can generate any number of snapshots from a blueprint. You can’t generate an accurate blueprint from any number of snapshots.</p><p>When AI tools generate a diagram for you, not only the results are not greate, the output is disposable by design as any other diagram.</p><p>When AI generates an architecture <em>model as code</em>, the output is a living document. You can diff it, branch it, query it, and render it into as many diagrams of different types as you need.</p><p>So the question worth asking isn’t <em>“can AI </em><strong><em>draw </em></strong><em>my architecture?”</em></p><p>It’s: <strong><em>“</em></strong><em>can AI </em><strong><em>model </em></strong><em>my architecture?</em><strong><em>”</em></strong></p><h3>So, can AI generate Architecture Model..?</h3><p>This is why I’ve added the AI generation feature to <a href="https://playground.c4interflow.com/">C4InterFlow Playground</a> — to see if it works, and make it available for everyone if it does.</p><p>Instead of generating a static diagram, it generates a YAML-based <em>architecture model as code</em> conforming to the <a href="https://github.com/SlavaVedernikov/C4InterFlow/blob/master/C4InterFlow/schema.json">C4InterFlow specification</a>. From a single model, you get C4 diagrams, static views, and sequence diagrams — all from the same source of truth. The YAML Architecture as Code can be exported, committed to Git, reviewed in pull requests, and loaded back into the Playground for further editing.</p><p>Let me show you what it actually looks like to use it.</p><p>The entire flow runs through a single dialog. No CLI. No configuration files. No separate tooling… And it’s <strong>FREE </strong>to use. Here’s how, step by step.</p><h3>Step 1: Describe your solution</h3><p>As you sign in to your C4InterFlow Playground Workspace, you’ll see <em>Generate Architecture Model</em> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*6SYa4O0TZ2WbGQbDn0waaA.png" /></figure><p>Clicking it opens the form. The first decision is <strong>Level of Detail</strong>:</p><ul><li><strong>Context</strong> — systems and their integrations only. For business stakeholders.</li><li><strong>Container</strong> — systems broken into deployable containers (APIs, databases, queues). For solution architects.</li><li><strong>Component</strong> — containers broken into internal components (services, repositories, controllers). For detailed software design.</li></ul><p>The Level of Details is the only required information before you start typing the description of your solution. Everything else is optional. You can even ask AI to give you solution suggestions. I simply pasted the <em>Health Insurance Quote and Enrolment</em> solution description (see above), same as I did for AI diagrams generation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*YuNo8MzTK7DmfvJsn96KTg.png" /></figure><p>Three optional tabs let you guide the output further:</p><ul><li><strong>Style</strong> (Monolyth, Microservices, Event-Driven, Hexagonal, and more)</li><li><strong>Patterns</strong> (Repository, Outbox, Saga, Circuit Breaker — grouped by category)</li><li><strong>Technology</strong> (specific frameworks, databases, message brokers).</li></ul><p>You can also type in custom patterns and technologies not on the pre-built list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*Eb9LPrUzAasye1jn83aSKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*otVkHnKS04zgzbJ1o_QzEw.png" /></figure><h3>Step 2: Validation before generation</h3><p>Clicking <strong>Validate &amp; Generate</strong> doesn’t immediately fire the AI generation. The modal expands to show an <strong>Architecture Review</strong> panel alongside your form. This validates your choices before spending a lot of AI tokens — I thought it was important not to waste compute on an architecturally inconsistent input.</p><p>Three categories of findings:</p><ul><li><strong>Blockers</strong> (red) — incompatible style/pattern combinations that would produce a contradictory model. You have to fix these before continuing.</li><li><strong>Warnings</strong> (amber) — suboptimal choices that won’t stop generation but may affect quality. Each warning has a <strong>Resolve</strong> button that asks the AI to fix it automatically.</li><li><strong>Ready</strong> (green) — confirmed valid selections.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*2i3oDBFucWui7-xWjQyQ1A.png" /></figure><h3>Step 3: Watch it build your Model</h3><p>Once you click <strong>Generate</strong>, a five-step progress sequence runs:</p><ol><li>Analysing features…</li><li>Defining design principles…</li><li>Analysing flows…</li><li>Generating YAML…</li><li>Running semantic consistency check…</li></ol><p>Each step gets a green checkmark when done. The whole thing takes 30–90 seconds depending on system complexity.</p><p><strong>NOTE</strong>: Sometimes the AI Model can be too busy, so you may get an error message. If this happens, just click <strong>Generate </strong>again and the app will continue from where it left off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*74f6Mwf2M606wgUlckaC5w.png" /></figure><h3>Step 4: Preview everything the AI generated</h3><p>When generation completes, you get a four-tab preview:</p><ul><li><strong>Architecture Model YAML</strong> — the actual <em>architecture as code</em></li><li><strong>Brief</strong> — a structured summary of all your input choices</li><li><strong>Features</strong> — the AI-extracted user stories, with persona names, type badges (user-driven, event-driven), and triggers</li><li><strong>Design Principles</strong> — the TOGAF-formatted architectural design principles that governed the generation</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*ZZ-VQl14IHvwLLMXb3847A.png" /></figure><p>You can <strong>Download</strong> a ZIP with all artifacts (model YAML, brief, features, design principles) for offline use or Git commit. Or click <strong>Load into Workspace</strong> to import the model directly into the C4InterFlow Playground visual editor.</p><h3>Step 5: The Model is live</h3><p>Once loaded, the C4InterFlow Playground renders the model into diagrams automatically. The full C4 hierarchy — systems, containers, components, and their interactions — is immediately available to explore and edit.</p><p>I’ve published this architecture model to the <strong>Architecture Marketplace </strong>— C4InterFlow Playground feature. You can find it here: <a href="https://playground.c4interflow.com/architecture-marketplace/health-insurance-quote-and-enrolment-5ygul349">Health Insurance Quote and Enrolment — C4 Architecture Diagram</a>. Clone it to your Workspace where you can visualise it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*WxtgCHxc1BRWGNYVwAya_A.gif" /></figure><p>This is what separates model generation from diagram generation.</p><p>What is loaded into the workspace isn’t an image. It’s a structured, editable, queryable model. Switch diagram types. Explore different levels of detail. Export the YAML to version control. The generation was the <em>starting point</em>, not the end product.</p><p>Here are just some example diagrams that Playground generates automatically from the Architecture model.</p><h4>C4 Context diagram of the whole solution</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbYOfetABCRUe3ccC6UIYA.png" /></figure><h4>C4 Container diagram of the whole solution</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sQWw1O8UwfqZNbVmehWf_Q.png" /></figure><h4>C4 Container diagram of the Request Quote flow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iSZ3LGpNR_-2HlK-5rya-A.png" /></figure><h4>C4 Container — Sequence diagram of the Request Quote flow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZUZNechwjo_-9JUclQJWQ.png" /></figure><h4>C4 Container diagram of the Submit Application flow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*CyfYd1G7p_y5CqHGAy6JDg.png" /></figure><h4>C4 Container — Sequence diagram of the Submit Application flow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hD8aNWsKLRQnIF2qQEzaOA.png" /></figure><p>The number of diagrams that you can now generate from the Architecture Model is virtually infinite… It all depends on what you need a diagram for and for what audience, the choice is yours.</p><p>I talk about this in details in <a href="https://medium.com/@slava.vedernikov/c4-model-diagrams-for-everyone-with-architecture-as-code-and-c4interflow-ae27ce5d1736">C4 Model diagrams for EVERYONE with Architecture as Code and C4InterFlow</a></p><h3>How the AI pipeline works under the hood</h3><p>Here’s the part I find most interesting, because the engineering decisions in the pipeline are what make the difference between plausible-looking YAML and a structurally sound architecture model.</p><p>The naive approach would be to throw everything into one prompt and hope coherent YAML comes out the other end. I tried that early on, and it doesn’t work.</p><p>What works is a <strong>multi-pass pipeline</strong> where each stage builds understanding that the next stage depends on.</p><h3>Pass 1: Extract the features first</h3><p>The pipeline starts not with technical components, but with <em>user value</em>.</p><p>The system takes your description and asks the AI model to extract Agile user stories — up to fifteen features capturing what your system does and for whom.</p><pre>{<br>  &quot;title&quot;: &quot;Health Insurance Quote and Enrolment&quot;,<br>  &quot;features&quot;: [<br>    {<br>      &quot;name&quot;: &quot;GenerateHealthInsuranceQuote&quot;,<br>      &quot;story&quot;: &quot;As Prospect I want to get a health insurance quote so that I can see available plans and premiums.&quot;,<br>      &quot;persona&quot;: &quot;Prospect&quot;,<br>      &quot;type&quot;: &quot;user-driven&quot;,<br>      &quot;trigger&quot;: &quot;The prospect provides basic personal information and requests a quote.&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;DisplayAvailablePlans&quot;,<br>      &quot;story&quot;: &quot;As Prospect I want to view available insurance plans and their premiums so that I can compare options.&quot;,<br>      &quot;persona&quot;: &quot;Prospect&quot;,<br>      &quot;type&quot;: &quot;user-driven&quot;,<br>      &quot;trigger&quot;: &quot;The system receives plan and premium information from the Quote Engine.&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;EmailQuoteToProspect&quot;,<br>      &quot;story&quot;: &quot;As QuoteGenerator I want to email the generated quote to the prospect so that they have a record and a link to continue.&quot;,<br>      &quot;persona&quot;: &quot;QuoteGenerator&quot;,<br>      &quot;type&quot;: &quot;system-driven&quot;,<br>      &quot;trigger&quot;: &quot;A new quote has been successfully generated and stored.&quot;<br>    }<br>...<br>}</pre><p>This isn’t just documentation. These features become the blueprint for what interfaces and flows the final model <em>must</em> contain. The architecture has to justify itself against what the system actually does for its users.</p><p>No features invented out of thin air. No components without a reason to exist.</p><h3>Pass 2: Establish architecture principles</h3><p>Next, the system applies TOGAF-style governance. It takes your chosen architecture styles and patterns and generates a set of structural principles that will govern the entire model.</p><p>These aren’t suggestions. They’re binding rules carried into every subsequent pass.</p><pre>{<br>  &quot;principles&quot;: [<br>    {<br>      &quot;category&quot;: &quot;Service Boundaries&quot;,<br>      &quot;name&quot;: &quot;Single Bounded Context Ownership&quot;,<br>      &quot;statement&quot;: &quot;Each microservice must encapsulate a single bounded context and be the exclusive owner of its domain data and business logic. Interactions between services must occur solely through well-defined APIs or asynchronous events.&quot;,<br>      &quot;rationale&quot;: &quot;This ensures clear separation of concerns, reduces coupling, and enables independent deployment and scaling of services. It prevents tangled dependencies that complicate maintenance and evolution, aligning with the business need for agility and rapid feature delivery.&quot;,<br>      &quot;implications&quot;: &quot;Development teams must rigorously define bounded contexts early in the design phase, requiring domain expertise. Cross-service data access directly to another service&#39;s database is strictly forbidden. This impacts data access patterns and may increase the need for data replication for read models.&quot;<br>    },<br>    {<br>      &quot;category&quot;: &quot;Data Access&quot;,<br>      &quot;name&quot;: &quot;Exclusive Data Store Ownership&quot;,<br>      &quot;statement&quot;: &quot;Each microservice must own its dedicated data store(s) and other services are forbidden from direct access. All data exposure must be mediated through the owning service&#39;s public API or emitted domain events.&quot;,<br>      &quot;rationale&quot;: &quot;This principle ensures autonomy for each service, allowing independent technology choices, scaling, and schema evolution without impacting other services. It protects data integrity and consistency within its bounded context, which is critical for accurate policy and quote management.&quot;,<br>      &quot;implications&quot;: &quot;Requires careful consideration of data consistency across services, potentially leading to eventual consistency models. Data replication for reporting or analytical purposes must be managed explicitly, often through event subscriptions or dedicated data aggregation services. This may increase storage costs and operational complexity.&quot;<br>    },<br>    {<br>      &quot;category&quot;: &quot;Event and Messaging&quot;,<br>      &quot;name&quot;: &quot;Canonical Event Broker&quot;,<br>      &quot;statement&quot;: &quot;Each domain event type must have a single, canonical Event Bus instance responsible for its publication and consumption. Both publishers and all consumers of a given event type must interact with this specific Event Bus instance.&quot;,<br>      &quot;rationale&quot;: &quot;This ensures consistent event delivery semantics, reliable message ordering where required, and simplifies event traceability across the system. It fosters a clear understanding of event flow, which is crucial for orchestrating complex business processes like application submission and policy activation.&quot;,<br>      &quot;implications&quot;: &quot;Requires standardisation on a single messaging technology for the Event Bus. Monitoring and management tools must be capable of tracking events through this specific broker. Development teams must adhere to a strict event schema definition and versioning strategy, impacting CI/CD pipelines.&quot;<br>    }<br>...<br>}</pre><p>This was one of the most important design decisions I made. The principles encode the chosen architecture’s invariants <em>before</em> the model is generated. The AI can’t violate them because it carries them as explicit constraints into every step that follows.</p><h3>Pass 3: Build the structure and behaviour skeleton</h3><p>This is where the architecture starts to take shape structurally.</p><p>The system asks the AI model to produce two things at once:</p><ol><li>A <strong>structure array</strong> — the full list of systems, containers, and components with their types</li><li>A <strong>flows array</strong> — one concrete flow per feature, expressed as sequences of interface-to-interface calls</li></ol><pre>{<br>  &quot;structure&quot;: [<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentFrontend.Containers.SpaClient [Spa]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApiGateway [Api]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.WebBff [Microservice]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteService [Microservice]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteReadDatabase [Database]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteCommandDatabase [Database]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApplicationService [Microservice]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApplicationReadDatabase [Database]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApplicationCommandDatabase [Database]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.EligibilityService [Microservice]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.EventBus [Topic]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.NotificationService.Containers.NotificationMicroservice [Microservice]&quot;,<br>    &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.CRMSyncService.Containers.CRMSyncMicroservice [Microservice]&quot;,<br>    &quot;HealthInsurance.Auth.SoftwareSystems.AuthenticationProvider [External]&quot;,<br>    &quot;HealthInsurance.External.SoftwareSystems.QuoteEngine [External]&quot;,<br>    &quot;HealthInsurance.External.SoftwareSystems.CrmSystem [External]&quot;,<br>    &quot;HealthInsurance.External.SoftwareSystems.EmailService [External]&quot;,<br>    &quot;HealthInsurance.External.SoftwareSystems.PolicyAdministrationSystem [External]&quot;<br>  ],<br>  &quot;flows&quot;: [<br>    {<br>      &quot;featureName&quot;: &quot;GenerateHealthInsuranceQuote&quot;,<br>      &quot;steps&quot;: [<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentFrontend.Containers.SpaClient.Interfaces.RequestQuote calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApiGateway.Interfaces.GenerateQuote&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApiGateway.Interfaces.GenerateQuote calls HealthInsurance.Auth.SoftwareSystems.AuthenticationProvider.Interfaces.ValidateToken&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApiGateway.Interfaces.GenerateQuote calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.WebBff.Interfaces.GenerateQuote&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.WebBff.Interfaces.GenerateQuote calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteService.Interfaces.SubmitQuoteRequest&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteService.Interfaces.SubmitQuoteRequest calls HealthInsurance.External.SoftwareSystems.QuoteEngine.Interfaces.GetQuote&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteService.Interfaces.SubmitQuoteRequest calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteCommandDatabase.Interfaces.InsertQuote&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteService.Interfaces.SubmitQuoteRequest calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.EventBus.Interfaces.PublishQuoteGeneratedEvent&quot;<br>      ]<br>    },<br>    {<br>      &quot;featureName&quot;: &quot;DisplayAvailablePlans&quot;,<br>      &quot;steps&quot;: [<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentFrontend.Containers.SpaClient.Interfaces.DisplayPlans calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApiGateway.Interfaces.GetAvailablePlans&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApiGateway.Interfaces.GetAvailablePlans calls HealthInsurance.Auth.SoftwareSystems.AuthenticationProvider.Interfaces.ValidateToken&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.ApiGateway.Interfaces.GetAvailablePlans calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.WebBff.Interfaces.GetAvailablePlans&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.WebBff.Interfaces.GetAvailablePlans calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteService.Interfaces.RetrieveAvailablePlans&quot;,<br>        &quot;HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteService.Interfaces.RetrieveAvailablePlans calls HealthInsurance.QuoteAndEnrollment.SoftwareSystems.QuoteAndEnrollmentBackend.Containers.QuoteReadDatabase.Interfaces.QueryPlans&quot;<br>      ]<br>    }<br>    ....<br>  ]<br>}</pre><p>Notice the fully-qualified paths. This is deliberate. Short names like QuoteService.SubmitQuoteRequest are ambiguous — the model has no way to know where they live in the namespace hierarchy. Full paths force explicitness, and they eliminate additional validation downstream.</p><h3>Pass 4: Generate the YAML</h3><p>With <em>features</em>, <em>design principles</em>, and <em>flows </em>established, the AI has a concrete task — translate all of that structured prior work into a valid C4InterFlow YAML model.</p><p>It’s not inventing the architecture at this point. It’s writing down a structure it has already reasoned through.</p><p>Even so, I learned some hard lessons here. YAML is unforgiving.</p><p>The most common failure is colons in string values. Unquoted colons cause YAML parse errors. So the prompt instructs the model:</p><ul><li>&#39;Atomic transaction: entity write and outbox write&#39; — single-quoted, colon allowed</li><li>Atomic transaction: entity write — <strong>wrong</strong>, causes a parse failure</li></ul><p>There’s another rule I had to make explicit in the prompt:</p><blockquote><em>CRITICAL — COPY THE EXPRESSION VERBATIM: The </em>callee path<em> string is already the complete, fully-qualified C4InterFlow path. Write it into the YAML Expression field EXACTLY as it appears in the step string. Do NOT shorten it.</em></blockquote><p>Without that, the model would occasionally abbreviate Shop.SoftwareSystems.OrderService.Containers.OrderApi.Interfaces.PlaceOrder to OrderApi.PlaceOrder — producing references that point nowhere. One instruction eliminates many possible errors.</p><h3>Pass 5: Self-correction (If needed)</h3><p>If the YAML fails structural parsing or JSON Schema validation, a correction pass runs. The model sees its own failed output plus the specific error messages, and fixes them.</p><p>This only runs on failure. No point paying for it when Pass 4 succeeds.</p><h3>Pass 6: Semantic consistency check (Always)</h3><p>This final AI pass runs unconditionally — even when resuming a cached generation. It reviews the complete YAML against some <em>architecture style</em> and <em>design patterns </em>specific semantic patterns:</p><ul><li>Cross-service database access (a service reading another service’s data store directly)</li><li>Message flow direction (publishing vs consuming mixed up)</li><li>Missing broker interfaces (events published to thin air)</li><li>Orphaned interfaces (declared but never called)</li><li>Dangling flows (referencing elements that don’t exist in the model)</li><li>Auth system declared but never called in any gateway flow</li></ul><p>That last one leads me to the most important post-processing step.</p><h3>The deterministic safety net</h3><p>After all AI passes, I added three deterministic post-processing steps for cases that LLMs get wrong <em>consistently enough</em> that a prompt fix isn’t enough — a code fix is more reliable.</p><p>The auth injection is the most important. If an authentication system exists in the model but is never explicitly called, the system automatically injects a ValidateToken call as the first step in every API/Gateway container flow.</p><p>Auth requirements get silently dropped by LLMs more often than I’d like. I’m not going to trust a prompt with that. So I handle it in code.</p><h3>Why the Multi-Pass approach produces better results</h3><p>Here’s the core insight: <strong>an LLM asked to generate a complete architecture model in one pass has nothing to constrain it.</strong></p><p>Without features, it invents whatever components seem plausible. Without principles, it doesn’t know which patterns your chosen architecture style prohibits. Without flows, it doesn’t know which interfaces must exist to make the system actually work.</p><p>Each pass narrows the possibility space. By the time the YAML is generated, the model is filling in a structure it has already reasoned to be correct.</p><p>The result is a model that:</p><ul><li>Contains exactly the elements needed to support your described user stories</li><li>Respects the structural constraints of your chosen architecture style</li><li>Has consistent, fully-qualified interface paths across all its flows</li><li>Is semantically consistent in its cross-service interaction patterns</li><li>Can be immediately rendered into C4, static, or sequence diagrams</li></ul><p>Compare that to the typical AI diagram result: a box labelled “API” connected to a box labelled “Database” connected to a box labelled “Queue.”</p><p>Technically not wrong. Architecturally useless.</p><h3>Where this is going</h3><p>I believe Architecture as Code is the future of how software teams document and reason about their systems. I’ve written about this in detail before — see <a href="https://medium.com/@slava.vedernikov/drawing-application-architecture-diagrams-manually-is-insane-fb0ad355b906">Drawing Application Architecture Diagrams Manually is ‘INSANE’</a> and <a href="https://medium.com/@slava.vedernikov/9-problems-with-application-architecture-documentation-and-how-architecture-as-code-can-solve-them-f0650467e24c">9 Problems with Application Architecture Documentation</a>.</p><p>AI-generated architecture <em>models</em> are what could finally make that future accessible to teams that don’t have dedicated architects with the time to build models by hand.</p><p>The diagram-generation tools you see today are a step in the right direction. But they’re generating the <em>wrong </em>artifact.</p><p>The <em>right </em>artifact is a structured, queryable, version-controllable model. It captures not just the rough shape of your system, but the design decisions, interaction patterns, feature flows, and structural invariants that make the architecture <em>yours</em>.</p><p>The difference between “<em>AI generates a plausible diagram</em>” and “<em>AI generates a structurally sound architecture model</em>” is exactly what I wanted to demonstrate, and I hope it inspires you to start thinking about software architecture in <em>models</em>, not <em>diagrams</em>.</p><p><strong>Try it </strong>yourself at<strong> </strong><a href="https://playground.c4interflow.com/"><strong>playground.c4interflow.com</strong></a><strong> </strong>and <strong>let me know what you think</strong>.</p><p>Lean more about <a href="https://www.c4interflow.com/">C4 InterFlow — Open Source Architecture as Code Framework</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7aa2ff6a72a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[C4 Model + Interfaces + Flows  — it’s a GAME-CHANGER!]]></title>
            <link>https://medium.com/@slava.vedernikov/c4-model-interfaces-flows-architecture-as-code-b95b91cb32d9?source=rss-d945b694fa73------2</link>
            <guid isPermaLink="false">https://medium.com/p/b95b91cb32d9</guid>
            <category><![CDATA[architecture-as-code]]></category>
            <category><![CDATA[diagrams-as-code]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[c4interflow]]></category>
            <category><![CDATA[c4-model]]></category>
            <dc:creator><![CDATA[Slava Vedernikov]]></dc:creator>
            <pubDate>Sat, 16 May 2026 16:04:02 GMT</pubDate>
            <atom:updated>2026-05-25T07:15:27.017Z</atom:updated>
            <content:encoded><![CDATA[<h3>C4 Model + Interfaces + Flows — it’s a GAME-CHANGER!</h3><figure><img alt="C4InterFlow App — Dynamic flow diagram" src="https://cdn-images-1.medium.com/max/1024/1*O-Jab4_af0j4oVCLc7nvQQ.png" /><figcaption>C4InterFlow App — C4 Model + Interfaces + Flows</figcaption></figure><p><strong>TLTR</strong></p><p>Software Architecture mainly describes two things — <strong>Structures </strong>and <strong>Behaviours</strong>. The <strong>C4 Model</strong> is brilliant for describing structures. It’s also good in terms of describing direct relationships between structures. However, structures alone (even with relationships) are not enough to model how software systems actually behaves.</p><p>C4InterFlow extends C4 Model with two additional concepts — <strong>Interfaces</strong> and <strong>Flows</strong>.<strong> </strong>This helps to bridge the gap between Architecture and Code, enabling full traceability and automatic generation of diagram of different Types at different Levels of Detail for any Use Case (scenario).</p><h3>The C4 Model changed how we think about architecture diagrams</h3><p><a href="https://c4model.com/">Simon Brown’s C4 Model</a> gave us something the industry desperately needed — a simple, hierarchical vocabulary for communicating software architecture. Four levels of abstraction — Software System (Context), Container, Component and Code — a shared language that works for both technical and non-technical audiences.</p><p>Tools like <a href="https://structurizr.com/">Structurizr</a>, <a href="https://github.com/plantuml-stdlib/C4-PlantUML">C4-PlantUML</a>, and <a href="https://mermaid.js.org/">Mermaid</a> brought that model into the “diagrams as code” world, which was another step forward. Your architecture diagrams can now live in source/version control. They can now be maintained within your codebase.</p><p>Structurizr actually goes a step further by allowing you to define structures and their direct relationships separately from views (diagrams), which is more like a model.</p><p>But there is a fundamental limitation that none of these tools address, and it has nothing to do with the tooling. It is a “limitation” of the model itself.</p><p><strong>The C4 Model describes structures and relationships. It does not describe distinct, granular capabilities, which makes it difficult to visualise specific Use Cases (scenarios).</strong></p><p>Again, Structurizr supports <a href="https://docs.structurizr.com/dsl/language#dynamic-view">dynamic views</a>, which you can use to describe specific Use Cases, but they are not linked to the model, so the flows have to be re-defined per view using relationships.</p><blockquote>Unlike the other diagram types, Dynamic views are created by specifying the relationships that should be added to the view, within the dynamic block.</blockquote><p>For example a generic System with Web Application, Web API, Database, Messaging and a Notification Engine may be modelled as follows in Structurizr DSL.</p><pre>workspace &quot;Name&quot; &quot;Description&quot; {<br><br>    !identifiers hierarchical<br><br>    model {<br>        u = person &quot;User&quot;<br>        ss = softwareSystem &quot;Software System&quot; {<br>            wa = container &quot;Web Application&quot;<br>            wapi = container &quot;Web API&quot;<br>            m = container &quot;Messaging&quot;<br>            ne = container &quot;Notification Engine&quot;<br>            db = container &quot;Database Schema&quot; {<br>                tags &quot;Database&quot;<br>            }<br>        }<br>        <br>        md = softwareSystem &quot;Mobile Device&quot;<br><br>        u -&gt; ss.wa &quot;Uses&quot;<br>        ss.wa -&gt; ss.wapi &quot;Get Post Patch and Delete Resources&quot;<br>        ss.wapi -&gt; ss.db &quot;Reads from and writes to&quot;<br>        ss.wapi -&gt; ss.m &quot;Publishes to&quot;<br>        ss.ne -&gt; ss.m &quot;Consumes from&quot;<br>        u -&gt; md &quot;Uses&quot;<br>        ss.ne -&gt; md &quot;Send to&quot;<br>    }<br><br>    views {<br>        systemContext ss &quot;Diagram1&quot; {<br>            include *<br>        }<br><br>        container ss &quot;Diagram2&quot; {<br>            include *<br>        }<br><br>        styles {<br>            element &quot;Element&quot; {<br>                color #446bc7<br>                stroke #446bc7<br>                strokeWidth 7<br>                shape roundedbox<br>            }<br>            element &quot;Person&quot; {<br>                shape person<br>            }<br>            element &quot;Database&quot; {<br>                shape cylinder<br>            }<br>            element &quot;Boundary&quot; {<br>                strokeWidth 5<br>            }<br>            relationship &quot;Relationship&quot; {<br>                thickness 4<br>            }<br>        }<br>    }<br><br>    configuration {<br>        scope softwaresystem<br>    }<br><br>}</pre><p>..which then will be rendered into a diagram below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJew3sqm0WwjPPl_ZTL5gw.png" /></figure><p>Notice generic and all encompassing labels on lines. They do not express any granularly defined capabilities.</p><h3>What “structures and relationships” mean in practice</h3><p>When you describe software architecture using standard C4 Model, you define the structures— Software Systems, Containers and Components — and the relationships between them. You can say <em>“Container A </em><strong><em>uses </em></strong><em>Container B”</em>. What you cannot say is <em>which specific capability</em> of Container B is being used, or <em>how that specific interaction flows</em> through the wider architecture. Sure you can say <strong>“</strong><em>Container A </em><strong><em>Reads from and writes to</em></strong><em> Container B”</em> — all in a single relationship, but it’s all too generic and not traceable end-to-end through the architecture.</p><p>This matters more than it might seem. In real systems, the “uses” relationship between two containers can represent many of distinct operations, each with its own flow through the architecture. Without a way to model those distinctions, your architecture model is structurally correct but behaviourally blind.</p><p>When architecture evolves, you need to know <em>what depends on what, specifically</em> no matter how deep in the end-to-end architecture those dependencies may be — not just which containers are loosely connected. Without that precision, you are back to manually tracing dependencies across diagrams, updating each one by hand, and hoping nothing was missed.</p><h3>Interfaces — the missing concept</h3><p>In software engineering, we have long understood that well-designed systems are built around interfaces. UI, API, CRUD operations, Send/Receive, Publish/Subscribe — they are all explicit declarations of exposed capabilities— <strong>Interfaces</strong>.</p><p>Design and Architecture patterns like Dependency Injection, Inversion of Control, Domain-Driven Design, Clean Architecture, Hexagonal Architecture (Ports and Adapters) all treat the <strong>Interface </strong>as the fundamental unit of composition.</p><p>C4InterFlow introduces this concept directly into the Architecture Model.</p><p>Every Software System, Container, and Component can declare its <strong>Interfaces</strong> — named, structured definitions of the capabilities it exposes. These are not just some side notes, they are <strong>first-class citizens</strong> of the model, in exactly the same way that Interfaces are first-class citizens in well-written code.</p><p>This single addition transforms the architecture model from a structural map into something that actually reflects how the system is built.</p><h3>Flows — traceability end-to-end</h3><p><strong>Flows</strong> are the second extension. A Flow defines how one Interface uses other Interfaces downstream — tracing the chain of interactions through the architecture stack, from the outermost entry point all the way to the lowest-level operation.</p><p>This mirrors exactly how code executes: a <strong>UI </strong>action triggers an <strong>API </strong>call, which calls a downstream <strong>service</strong>, which writes to a <strong>database </strong>etc. In C4InterFlow, that entire chain is modelled explicitly.</p><p>Here is how the previously modelled generic System looks in C4InterFlow YAML DSL.</p><pre># yaml-language-server: $schema=https://raw.githubusercontent.com/SlavaVedernikov/C4InterFlow/refs/heads/master/C4InterFlow/schema.json<br>GenericExample:<br>  SoftwareSystems:<br>    SoftwareSystem:<br>      Containers:<br>        DatabaseSchema:<br>          Interfaces:<br>            InsertData: {}<br>            UpdateData: {}<br>            SelectData: {}<br>            DeleteData: {}<br>        TasksApi:<br>          Label: Web API<br>          Interfaces:<br>            GetResources:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.DatabaseSchema.Interfaces.SelectData<br>            PostResource:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.DatabaseSchema.Interfaces.InsertData<br>                - Type: Use<br>                  Expression: Containers.Messaging.Interfaces.PublishCreatedEvent<br>            PatchResource:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.DatabaseSchema.Interfaces.UpdateData<br>                - Type: Use<br>                  Expression: Containers.Messaging.Interfaces.PublishUpdatedEvent<br>            DeleteResource:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.DatabaseSchema.Interfaces.DeleteData<br>        WebApplication:<br>          Interfaces:<br>            ViewData:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.TasksApi.Interfaces.GetResources<br>            CreateData:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.TasksApi.Interfaces.PostResource<br>            UpdataData:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.TasksApi.Interfaces.PatchResource<br>            DeleteData:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.TasksApi.Interfaces.DeleteResource<br>        Messaging:<br>          Interfaces:<br>            PublishCreatedEvent: {}<br>            ConsumeCreatedEvent: {}<br>            PublishUpdatedEvent: {}<br>            ConsumeUpdatedEvent: {}<br>        NotificationEngine:<br>          Interfaces:<br>            SendNotification:<br>              Flows:<br>                - Type: Use<br>                  Expression: Containers.Messaging.Interfaces.ConsumeCreatedEvent<br>                - Type: Use<br>                  Expression: Containers.Messaging.Interfaces.ConsumeUpdatedEvent<br>                - Type: Use<br>                  Expression: ..MobileDevice.Interfaces.SendNotification<br>    MobileDevice:<br>      Interfaces:<br>        SendNotification: {}<br>        ReceiveNotification: {}<br>  Actors:<br>    User:<br>      Type: Person<br>      Activities:<br>        ViewData:<br>          Flows:<br>            - Type: Use<br>              Expression: ..SoftwareSystem.Containers.WebApplication.Interfaces.ViewData<br>        UpdateData:<br>          Flows:<br>            - Type: Use<br>              Expression: ..SoftwareSystem.Containers.WebApplication.Interfaces.UpdataData<br>        CreateData:<br>          Flows:<br>            - Type: Use<br>              Expression: ..SoftwareSystem.Containers.WebApplication.Interfaces.CreateData<br>        DeleteData:<br>          Flows:<br>            - Type: Use<br>              Expression: ..SoftwareSystem.Containers.WebApplication.Interfaces.DeleteData<br>        ViewNotifications:<br>          Flows:<br>            - Type: Use<br>              Expression: ..MobileDevice.Interfaces.ReceiveNotification</pre><p>This is not a “diagram as code”. This is an Architecture Model that <em>knows how the system behaves.</em></p><p>Using C4InterFlow App we can now create an end-to-end view with all interfaces in scope, which would look like this…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyzmTAIAarF9R_q9_PdnjA.png" /></figure><p>Notice how each line has multiple labels (one for each Interface flow between two elements).</p><h3>So, what’s possible now..?</h3><p>Once <strong>Interfaces </strong>and <strong>Flows </strong>are in the model, diagram generation becomes a fundamentally different activity. Instead of specifying what to draw, you specify S<strong>cope</strong> — which Interfaces you want to visualise — and C4InterFlow generates the diagram automatically, tracing every downstream <em>Use </em>flow for all in-scope Interfaces.</p><p>The same model produces Context diagrams, Container diagrams, Component diagrams, and Flow (Sequence) diagrams. The same model supports multiple Levels of Detail… You define the architecture once and every view follows from it.</p><p>The model also knows what depends on what. Change an Interface and you can immediately see every Flow that references it — across entire architecture. This is impact analysis that would otherwise require hours of manual cross-referencing.</p><p>Here are just some other diagrams that C4InterFlow generates automatically from the same Architecture Model of that generic System.</p><h4>“View Data” <strong>Flow</strong></h4><p>By clicking on the <em>View Data</em> label, C4InterFlow highlights the <em>View Data</em> flow through the architecture stack with each step clearly numbered with the sequence. This may not seem like a big deal for such a small diagram, but wait…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5NVrQ2MXHpqA3FxnmKv3Q.png" /></figure><h4>“Update Data” Flow</h4><p>From this flow it’s now clear that when data is updated, events are published to the Messaging container as well as saving data to the Database.</p><p>Imagine what this kind of dynamic visualisation of scenario-specific flows can do for large systems… I already know, I’m using it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7ebtv1x9j44hxxfPMw8XQ.png" /></figure><p>Just by changing the Diagram type you can now see a Sequence diagram for that flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LwTQoMmoE14anKAyJr3xcw.png" /></figure><p>You can keep changing Scope, Level of Detail and Diagram Type and C4InterFlow App would give you just the right diagram every time… All from a single Architecture Model!</p><h3>Actors, Activities, and Business Processes</h3><p>C4InterFlow takes this further with Actors, Activities, and Business Processes. You can define who does what in your system, model the logic of each Activity using Interfaces and Flows, and compose Business Processes from those Activities and Interface. Add a Business Process to your view scope and C4InterFlow visualises everything automatically — every actor, every system interaction, every downstream flow.</p><p>This closes the loop between business behaviour and technical architecture in a way that no other C4 Model tool supports!</p><h3>The formula</h3><p><strong>C4InterFlow = C4 Model + Interfaces + Flows</strong></p><p>The <strong>C4 Model</strong> gave us the right vocabulary for software architecture. <strong>Interfaces </strong>gave us the ability to model capability explicitly. <strong>Flows </strong>gave us end-to-end traceability. Together, they turn the Architecture Model into a living, query-able representation of how a system actually works.</p><p>This is the difference between “<em>diagramming</em>” and “<em>modelling architecture</em>.” An architecture diagram is just a view from a specific viewpoint— not the architecture model.</p><p>The C4InterFlow framework is open-source and supports YAML, C#, and JSON DSLs.</p><p>The <a href="https://app.c4interflow.com/"><strong>C4InterFlow App</strong></a> is its visual counterpart — a cloud-based Architecture Modelling tool for teams who want the same capabilities without writing a line of YAML. Both are fully interoperable.</p><p><strong>It’s a GAME-CHANGER…! So try it now and let me know what you think.</strong></p><h3>Get started</h3><ul><li>Try <a href="https://playground.c4interflow.com/"><strong>C4InterFlow Playground</strong></a><strong> </strong>— load and explore C4InterFlow sample Architecture Models or create your own.</li><li>Try <a href="https://app.c4interflow.com/"><strong>C4InterFlow App</strong></a><strong> </strong>free— one repository, 100 interfaces, no credit card required.</li><li>Like it..? Star the<strong> </strong><a href="https://github.com/SlavaVedernikov/C4InterFlow"><strong>open-source framework on GitHub</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b95b91cb32d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[C4 Model diagrams for EVERYONE with Architecture as Code and C4InterFlow]]></title>
            <link>https://medium.com/@slava.vedernikov/c4-model-diagrams-for-everyone-with-architecture-as-code-and-c4interflow-ae27ce5d1736?source=rss-d945b694fa73------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae27ce5d1736</guid>
            <category><![CDATA[architecture-as-code]]></category>
            <category><![CDATA[c4interflow]]></category>
            <category><![CDATA[diagram-as-code]]></category>
            <category><![CDATA[architecture-diagram]]></category>
            <category><![CDATA[c4-model]]></category>
            <dc:creator><![CDATA[Slava Vedernikov]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 17:58:01 GMT</pubDate>
            <atom:updated>2024-09-10T17:58:01.433Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Summary</strong></h3><p>The C4 Model by Simon Brown simplifies application architecture visualisation with <strong>4 Levels of Detail</strong>: <em>Context</em>, <em>Container</em>, <em>Component</em>, and <em>Code</em>, making it accessible to both <em>technical</em> and <em>non-technical</em> stakeholders.</p><p>However, manually creating diagrams for different <em>Viewpoints</em> and <em>Stakeholders</em> can be time-consuming and inefficient.</p><p>This is where <strong>Architecture as Code (AaC)</strong>, and specifically the <a href="https://github.com/SlavaVedernikov/C4InterFlow"><strong>C4InterFlow</strong> </a>framework, excels. It allows for dynamic slicing and dicing of the <em>Architecture Model</em> based on <strong>Scope, Level of Detail, </strong>and<strong> Diagram Type</strong> to automatically generate tailored C4 Model diagrams for every stakeholder.</p><p>With <strong>C4InterFlow</strong>, you can easily create various views from different perspectives, ensuring that the right level of detail and scope is presented to the right audience, <strong>making the architecture</strong> accessible and <strong>meaningful to everyone</strong> involved.</p><h3>C4 Model</h3><p>C4 Model <strong>- </strong><a href="https://c4model.com/">Architecture Visualisation framework by Simon Brown</a> - has gained its popularity amongst Engineers and Architects primarily for <strong>two reasons</strong> (in my view):</p><ol><li>It is focused on the Enterprise Architecture domain that is usually well understood by both <strong>technical</strong> and <strong>non-technical</strong> stakeholders i.e. <strong>Application Architecture</strong>. As per <a href="https://pubs.opengroup.org/architecture/togaf9-doc/arch/chap30.html">TOGAF Content Framework</a> (see below), Application Architecture sits conveniently right between Business Architecture and Technology Architecture, so the concepts of Application Architecture can be easily linked to <strong>non-technical</strong> concepts in the <strong>Business Architecture</strong> as well as to <strong>technical </strong>concepts in the <strong>Technology Architecture</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZmT-Ol3qt2IVDG3AJRmbA.png" /></figure><p><strong>2. </strong>It makes it easy to communicate Application Architecture to different audiences with its 4 <strong>Levels of Detail</strong> (4 Cs):</p><ul><li><strong>Context </strong>(Level 1) - <em>Software Systems</em> and their relationships in the context of the <em>Enterprise</em></li><li><strong>Container </strong>(Level 2) - <em>Containers </em>and their relationships in the context of <em>Software System(s)</em></li><li><strong>Component </strong>(Level 3) - <em>Components </em>and their relationships in the context of <em>Container(s)</em></li><li><strong>Code </strong>(Level 4) - <em>Classes </em>and their relationships in the context of <em>Component(s)</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HTn1UnR47UedBsu0.png" /><figcaption>C4 Model — Levels of Details - <a href="https://c4model.com/">c4model.com</a></figcaption></figure><h3>Viewpoints and Views</h3><p><a href="https://pubs.opengroup.org/architecture/togaf8-doc/arch/chap31.html#tag_32_11">TOGAF defines a few key concepts</a> such as <em>Stakeholders</em>, <em>Concerns</em>, <em>Viewpoints</em> and <em>Views</em>, which when used together can help Architects to describe systems effectively for different audiences. The concepts of Viewpoints and Views that address Concerns of different Stakeholders are also relevant when using C4 Model as an Application Architecture visualisation framework.</p><p>When I use C4 Model, I often think of two dimensions that help me construct relevant <em>View(s)</em> for a given <em>Stakeholder </em>— <strong>Level of Details</strong> and <strong>Scope</strong>.</p><h3>Level of Details</h3><p>Levels of Detail are clearly defined by C4 Model. It is also easy to determine the most likely audience for views of different Levels of Detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Va0Lb4JxXILm8PHba1Ck2Q.png" /></figure><h3>Scope</h3><p>There is another very important dimension that needs to be considered when using C4 Model to effectively document Application Architecture i.e. <em>Scope</em>.</p><p>Defining the Scope for a particular <em>View</em> is basically deciding which System(s) (or Container(s), Component(s) etc.) to include in the view for a particular <em>Stakeholder</em>. This decision must go hand-in-hand with the decision on the Level of Details for that same view to ensure that the diagram representing the view is both <em>useful </em>and <em>readable</em>.</p><p>Your diagram will most likely be too busy<strong> </strong>and therefore <strong>unreadable </strong>if you choose <strong>Large Scope</strong> and <strong>Low Level of Details</strong>. On the other hand, your diagram may <strong>not </strong>be that <strong>useful </strong>if you go for <strong>Small Scope</strong> and <strong>High Level Of Details</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*d2HsUQ55uqmVPnrd1xNBmg.png" /></figure><h3>The problem</h3><p>When you take into account the <em>Scope </em>and the <em>Level of Details</em> each time you need to communicate Application Architecture to different audiences or in different contexts (e.g. Project, Initiative, Program etc.) you will inevitably end up drawing (or coding when using <a href="https://c4model.tools/#text-based-diagramming-tools">Diagrams as Code tools</a>) multiple diagrams. It is also guaranteed that you would have to duplicate the same structures and their relationships in those diagrams… and this is just one of many <strong>problems</strong> that you will face if you <strong>think in diagrams</strong>. I described it all in a separate article - <a href="https://medium.com/@slava.vedernikov/9-problems-with-application-architecture-documentation-and-how-architecture-as-code-can-solve-them-f0650467e24c">How Architecture as Code can solve these 9 PROBLEMS with Application Architecture diagrams</a>.</p><p>Yes, Architecture as Code or to be more precise, <strong>Architecture Model</strong> as Code. I strongly believe that Architects and Engineers must stop drawing (or coding) Application Architecture diagrams if they want their documentation to last and stay relevant and useful. I explained my reasons in another article - <a href="https://medium.com/@slava.vedernikov/drawing-application-architecture-diagrams-manually-is-insane-fb0ad355b906">Drawing Application Architecture Diagrams manually is “INSANE”</a>.</p><h3>Architecture as Code</h3><p>The idea behind Architecture as Code is quite simple — express Architecture Model in code and use that model to generate diagrams for different viewpoints.</p><p>There are a number of projects out there that tried to provide a Domain Specific Language (DSL) for expressing Architecture Model and some tooling for generating diagrams. Here are just a few examples:</p><ul><li><a href="https://www.structurizr.com/">Structurizr</a></li><li><a href="https://github.com/lonely-lockley/archinsight">Archinsight</a></li><li><a href="https://github.com/finos-labs/architecture-as-code/tree/main/calm">FINOS Labs Common Architecture Language Model (CALM)</a></li><li><a href="https://github.com/dwmkerr/architecture-as-code">https://github.com/dwmkerr/architecture-as-code</a></li><li><a href="https://github.com/jsoconno/architectures">https://github.com/jsoconno/architectures</a></li></ul><p>When I arrived to a conclusion that Architecture Modelling is the way I want to work with Application Architecture as opposed to diagramming, I started assessing the available tools. Unfortunately, I quickly realised that all of these tools have the same flaw in common — their DSLs are built on concepts closely resembling Diagrams as Code concepts i.e. Structures (Boxes) and “hard” Relationships (Lines). So, in my view, they are not “true” modelling tools. I explained this in more details in the article <a href="https://medium.com/@slava.vedernikov/my-journey-to-c4interflow-open-source-architecture-as-code-framework-fc7049672375">My journey to C4InterFlow — Open-Source Architecture as Code Framework</a>.</p><p>Yes, I decided to build my own framework and make it open-source :)</p><h3>C4InterFlow — Architecture as Code framework</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/0*0WUH1B3KQBIzOq-q.png" /><figcaption><a href="https://github.com/SlavaVedernikov/C4InterFlow">C4InterFlow</a> = <strong>C4</strong> Model + <strong>Inter</strong>faces + <strong>Flow</strong>s</figcaption></figure><h4>Vision 💡</h4><p>Transform the landscape of <strong>Application Architecture</strong> by bridging the gap between <strong>Architecture Model</strong> and <strong>Code</strong>.</p><h4>Mission 🎯</h4><p>Provide a comprehensive <strong>Application Architecture</strong> framework for IT Professionals to</p><ol><li>Effortlessly express <strong>Application Architecture as Code</strong> (AaC)</li><li>Use AaC to build <strong>Business Processes as Code</strong> (BPaC)</li><li>Automatically <strong>generate </strong>Application and Business Architecture <strong>diagrams </strong>and other <strong>documentation </strong>from AaC and BPaC</li><li>Intuitively <strong>analyse</strong> Application Architecture by issuing simple <strong>queries</strong> against AaC</li></ol><h4>Short story</h4><p>I knew that <strong>C4 Model</strong> is not an Architecture Framework, it is rather an Architecture Visualisation Framework. So, when I looked carefully at C4 Model abstractions (i.e. Software Systems, Containers, Components and Code), and I compared those to the metamodels of other frameworks like ArchiMate and TOGAF. I realised that C4 Model is “missing” a key concept that could bring it closer to an Architecture Modelling framework i.e. <strong>Interface</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IDAC_yotmQILJKVf.png" /><figcaption>C4 Model abstractions — <a href="https://c4model.com/">c4model.com</a></figcaption></figure><p>C4 Model diagrams depict Structures (i.e. Software Systems, Containers, Components etc.) and their Relationships, but those relationships cannot be formed unless Structures expose clear Interfaces. When Interfaces are exposed by Structures then any given Interface can <em>use </em>other Interfaces, and that’s how the relationships between Structures are formed.</p><p>Then I thought about how any given Interface would typically <em>use </em>other Interfaces, and I realised that it could be that a single Interface <em>uses</em> multiple other Interfaces in certain order and sometimes even conditionally. This led me to another “missing” concept i.e. <strong>Flow</strong>.</p><h4>Metamodel</h4><p>In addition to <em>Interfaces</em> and <em>Flows </em>C4Interflow also introduces concepts like <em>Namespace</em> and <em>Business Process</em>.</p><ul><li><strong>Namespaces</strong> can be used to logically group Software Systems (e.g. by Business Domain or Function).</li><li><strong>Business Processes</strong> can be composed of <em>Activities</em> performed by <em>Actors</em>, where each Activity can have <em>Flows</em> that use <em>Interfaces</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*IJfMRdtw5or0TFgc.png" /><figcaption><a href="https://github.com/SlavaVedernikov/C4InterFlow">C4InterFlow</a> Metamodel</figcaption></figure><p>All of these concepts allow new ways of defining <strong>Scope </strong>when deciding on what to include in the <em>View </em>from a particular <em>Viewpoint</em> for a particular<em> Stakeholder.</em></p><h4>Diagram types</h4><p>As I said earlier C4InterFlow comes with tools like CLI that can be used to generate Architecture Diagrams. In theory any <strong>Types </strong>of diagrams that describe Structures and their Relationships can be auto-generated, but for now C4InterFlow can generate <em>C4</em>, <em>C4 Static</em>, <em>C4 Sequence</em> and <em>UML Sequence</em> diagrams.</p><p>Diagram <strong>Type</strong> adds another dimension to the previously mentioned <strong>Level of Details</strong> and <strong>Scope</strong> when it comes to deciding what <em>View</em> needs to be created for a particular <em>Viewpoint</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*VaApDYV3AKfxxcj_eNqTdA.png" /></figure><p>When using <a href="https://github.com/SlavaVedernikov/C4InterFlow/wiki/Command-Line-Interface-(CLI)">C4InterFlow CLI</a> to generate diagrams you can be very specific about all three dimensions or you can omit them completely and let the framework generate diagrams for all possible combinations of all supported values of all three dimensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*-xhsDEhVLkxaDCuGPVNi8w.png" /></figure><h4>Visualisation</h4><p><a href="https://github.com/SlavaVedernikov/C4InterFlow/wiki/Command-Line-Interface-(CLI)">C4InterFlow CLI</a> provides publishing command that can publish all auto-generated diagrams as a static website where anyone from your organisation can navigate Architecture Diagrams by all available <strong>Scopes</strong>, <strong>Levels of Detail</strong>, <strong>Diagram Types</strong> and <strong>Formats</strong> (including diagrams source code in <em>PlantUML</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-9WMzXsqx2CjH80CN7iVbQ.png" /><figcaption>E-Commerce Platform example <a href="https://c4interflow.github.io/architecture-as-code-samples-visualiser/e-commerce-platform/">Architecture Website</a></figcaption></figure><p>See more published <a href="https://c4interflow.github.io/architecture-as-code-samples-visualiser/">Architecture Websites for different Architecture as Code C4InterFlow samples</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae27ce5d1736" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drawing Application Architecture Diagrams manually is “INSANE”]]></title>
            <link>https://medium.com/@slava.vedernikov/drawing-application-architecture-diagrams-manually-is-insane-fb0ad355b906?source=rss-d945b694fa73------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb0ad355b906</guid>
            <category><![CDATA[c4-model]]></category>
            <category><![CDATA[architecture-as-code]]></category>
            <category><![CDATA[diagram-as-code]]></category>
            <category><![CDATA[c4interflow]]></category>
            <category><![CDATA[good-software-diagrams]]></category>
            <dc:creator><![CDATA[Slava Vedernikov]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 09:27:18 GMT</pubDate>
            <atom:updated>2024-06-27T09:27:18.350Z</atom:updated>
            <content:encoded><![CDATA[<p><em>…It’s like riding a </em><strong><em>horse-drawn carriage</em></strong><em> when you can take a </em><strong><em>high-speed train</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4J3u684629J9Ucs5W4LJZQ.png" /><figcaption>Drawing Software/Application Architecture Diagrams manually v Auto-generating them</figcaption></figure><p><strong>Effective communication</strong> is key to the success<strong> </strong>of any software development project and <strong>Architecture Diagrams</strong> are the most popular medium when it comes to sharing ideas and solutions. They help us to understand, communicate, and document the <strong>structures</strong> and <strong>behaviours</strong> of complex systems. However, many teams still rely on the <strong>traditional approach</strong> of manually creating and updating these diagrams, which is <strong>error-prone</strong> and can quickly become <strong>overwhelming</strong>.</p><p>Manual diagramming is cumbersome and it comes with a few issues that can hinders development process. This approach is not just outdated — it’s “insane”</p><p>Some of you would say: <em>“Yes, I know, and that’s why I don’t draw diagrams, I code them…”</em>. Great, now your diagrams may be in source control and you can review changes with pull requests, but that’s about it. It is still <strong>manual diagramming</strong>, so you still have a lot of the same issues.</p><h3>The issues</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K56IRDlBjplNI_YArg_7kg.png" /></figure><h4>Complexity and overcrowded diagrams</h4><p>As systems grow in complexity, so do the architecture diagrams that discribe them. Manually drawing (or coding) these diagrams often leads to <strong>overcrowded visuals</strong> that are hard to read and understand. The more components and interactions you need to represent, the more <strong>cluttered</strong> your diagram becomes. This clutter makes it difficult for team members to grasp the architecture at a glance, leading to <strong>confusion</strong> and <strong>misinterpretation</strong>.</p><h4>Inconsistencies</h4><p>Manually maintaining architecture diagrams across different <strong>views</strong> and <strong>levels of detail</strong> is a challenge. Inconsistencies can creep in as diagrams are updated or modified over time. A change in one part of the system may not be reflected across all relevant diagrams, leading to a <strong>fragmented</strong> understanding of the architecture. And to make things worse, with multiple team members potentially updating diagrams, <strong>different styles</strong>, <strong>notations</strong>, and <strong>levels of detail</strong> creep in, making it hard to interpret the architecture correctly.</p><h4>Duplication</h4><p>Duplication of efforts is another issue, as the <strong>same structures</strong> and <strong>behaviours</strong> may need to be revisited in <strong>different contexts</strong> when changes occur. Updating all affected diagrams becomes <strong>time-consuming</strong> and <strong>error-prone</strong>.</p><h4>Out-of-date documentation</h4><p>Keeping architecture diagrams up-to-date manually is a <strong>daunting</strong> task. As the systems evolve, the diagrams often lag, becoming <strong>obsolete</strong>. Out-of-date documentation can <strong>mislead</strong> developers and other stakeholders, causing <strong>errors</strong> and <strong>misaligned</strong> efforts. In the fast-paced world of software development, having accurate, current diagrams is crucial for making well-informed decisions.</p><h3>The consequences</h3><h4>Collaboration difficulties</h4><p>Manual diagrams are often created in <strong>isolation</strong> and are shared as <strong>static images</strong> or files. This makes collaborative editing and review <strong>cumbersome</strong>. Different team members may have different versions of a diagram, leading to a <strong>lack of synchronisation</strong> and increased chances of <strong>errors</strong>. Collaborative tools that support real-time updates are essential but are rarely available for manual diagrams.</p><p>As I mentioned above, teams using “Diagrams as Code” with tools like <a href="https://mermaid.js.org/">Mermaid</a>, <a href="https://www.plantuml.com/">PlantUML </a>etc. would probably have less of an issue with collaboration, but there is a <strong>better way</strong>, read on :)</p><h4>Increased risk of wrong decisions</h4><p>Inconsistent, outdated, or unclear diagrams can lead to wrong architectural decisions. When team members don’t have a clear, unambiguous and accurate view of the systems, they might make <strong>assumptions</strong> that lead to <strong>design flaws</strong> or <strong>inefficiencies</strong>. These mistakes can be costly and time-consuming to rectify.</p><h4>Productivity impact and architecture management costs</h4><p>The time and effort spent on manually creating and maintaining architecture diagrams can significantly impact productivity. Developers and architects could spend this time more effectively on designing and implementing solutions. Additionally, the <strong>cost </strong>of managing and updating these diagrams can add up, <strong>diverting resources</strong> from more critical tasks.</p><h3>Architecture as Code - a smarter approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAQQnGPva8UWTpCRLZaZ6g.png" /></figure><h4>Introducing Architecture as Code</h4><p>Architecture as Code (AaC) is an approach where <strong>architecture models</strong> are expressed <strong>in code</strong>, typically using formats like <strong>YAML</strong> or <strong>JSON</strong>. This approach allows for <strong>auto-generation</strong> of architecture <strong>diagrams </strong>of different <strong>Types</strong>, <strong>Scopes</strong>, and <strong>Levels of Detail</strong> on-demand and from a single source of truth. Let’s see how AaC addresses the challenges of manual diagramming.</p><h4>Dealing with complexity</h4><p>With AaC, the architecture is expressed with <strong>code</strong> in a <strong>modular fashion</strong>. Tools like <a href="https://github.com/SlavaVedernikov/C4InterFlow"><strong>C4InterFlow</strong></a> can parse the architecture code and automatically generate clear, well-organised diagrams that accurately represent the systems’ structures and behaviours. <strong>Modularisation</strong> and <strong>automation</strong> ensure that the architecture models are easy to manage and diagrams are easy to read and understand, regardless of architecture complexity.</p><h4>Ensuring consistency</h4><p>Since all diagrams are generated from the same architecture model, <strong>consistency is guaranteed</strong>. Any changes made to the architecture code are reflected across all generated diagrams, eliminating discrepancies and ensuring that <strong>all views are in sync</strong>. This consistency is crucial for maintaining a clear and accurate understanding of the systems.</p><h4>Keeping documentation up-to-date</h4><p>AaC coupled with automation ensures that <strong>architecture diagrams are always up-to-date</strong>. As the systems evolve, updating the architecture code automatically updates all related diagrams. With modular architecture model representation, each team can take ownership of their part of architecture model. This process ensures that the documentation remains <strong>current</strong>, providing an <strong>accurate</strong> reference for developers, architects and other stakeholders.</p><h4>Facilitating collaboration</h4><p>AaC promotes better collaboration by enabling architecture models to be stored in version control systems. Team members can work on the architecture code collaboratively, just like they do with source code. Changes are tracked, and conflicts can be resolved through standard version control practices. This approach fosters a more <strong>integrated</strong> and <strong>efficient</strong> workflow.</p><h4>Reducing risk</h4><p>By providing a clear and accurate view of the systems, AaC helps <strong>mitigate the risk</strong> of making wrong architectural decisions. Teams can rely on <strong>up-to-date</strong>, <strong>consistent</strong> diagrams to inform their decisions, reducing the chances of costly errors and misaligned efforts.</p><h4>Boosting productivity and reducing costs</h4><p>Auto-generation of architecture diagrams <strong>frees up valuable time</strong> for developers and architects. They can focus on <strong>designing</strong> and <strong>building solutions</strong> rather than spending time on manual diagrams maintenance. This <strong>increased productivity</strong> translates to <strong>cost savings</strong> and more efficient use of resources.</p><h3>Conclusion</h3><p>Drawing (or coding) Software/Application Architecture Diagrams manually is not only tedious but also full of challenges that can impede project’s success. From <strong>complexity</strong>, <strong>duplication </strong>and <strong>inconsistency</strong> to <strong>outdated documentation</strong> and <strong>collaboration difficulties</strong>, the pitfalls of manual diagramming are numerous.</p><p>Embracing <strong>Architecture as Code</strong> (AaC) offers a <strong>smarter</strong>, <strong>more efficient</strong> alternative. By expressing architecture models in code and generating diagrams automatically, AaC ensures <strong>clarity</strong>, <strong>consistency</strong>, and <strong>up-to-date documentation</strong>, ultimately leading to <strong>better decisions</strong>, <strong>improved collaboration</strong>, and <strong>increased productivity</strong>.</p><p>In today’s fast-paced development environment, <strong>adopting Architecture as Code</strong> is not just a smart choice — it’s a <strong>necessity</strong>.</p><p>Knowing that there is a better way, and still clinging to manual architecture diagramming <strong>would indeed be insane</strong>!</p><p>Check out <a href="https://github.com/SlavaVedernikov/C4InterFlow"><strong>C4InterFlow</strong></a> — my <strong>open-source Architecture as Code framework</strong> for more <a href="https://github.com/SlavaVedernikov/C4InterFlow/wiki">information</a> and <a href="https://c4interflow.github.io/architecture-as-code-samples-visualiser/">samples</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RNZhyub-HQRjIS7GuQYdHQ.png" /></figure><h4>Notes from my personal experience with C4InterFlow</h4><p>On a project where we had diagrams generation fully automated with GitHub Actions and <a href="https://github.com/SlavaVedernikov/C4InterFlow/wiki/Command-Line-Interface-(CLI)">C4InterFlow CLI</a>, it’s been a pure joy seeing diagrams of all supported <strong>Types</strong>, <strong>Scopes</strong> and <strong>Levels of Details</strong> (i.e. <a href="https://c4model.com/">C4 Model</a> levels) generated and published automatically every time Architecture Model changed.</p><p>On some other projects, where it wasn’t fully automated, I generated diagrams using <a href="https://github.com/SlavaVedernikov/C4InterFlow/wiki/Command-Line-Interface-(CLI)">C4InterFlow CLI</a>. Then, honestly, it took me longer to select the most appropriate diagrams and publish the corresponding auto-generated PNG and PlantUML files to Confluence than it took me to update the Architecture Model in YAML each time there were architecture changes needed.</p><p>I haven’t drawn (or coded) any architecture diagrams since I started using C4InterFlow about a year ago, and I don’t miss it :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb0ad355b906" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Architecture as Code can solve these 9 PROBLEMS with Application Architecture diagrams]]></title>
            <link>https://medium.com/@slava.vedernikov/9-problems-with-application-architecture-documentation-and-how-architecture-as-code-can-solve-them-f0650467e24c?source=rss-d945b694fa73------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0650467e24c</guid>
            <category><![CDATA[architecture-as-code]]></category>
            <category><![CDATA[architecture-diagram]]></category>
            <category><![CDATA[application-architecture]]></category>
            <dc:creator><![CDATA[Slava Vedernikov]]></dc:creator>
            <pubDate>Tue, 14 May 2024 10:52:58 GMT</pubDate>
            <atom:updated>2024-05-28T08:23:51.087Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JEz0vnxPoOnd4dx9WrbMyw.png" /></figure><p>Documenting Application Architecture with diagram drawing tools like <em>Visio</em>, <em>Miro</em>, <em>LucidCharts etc</em>., while popular and often effective, poses several <strong>key problems</strong> that stem from the inherent <strong>limitations </strong>of these tools and the <strong>complex nature</strong> of Application Architecture.</p><p>Here, I will try to demonstrate how shifting towards <strong>Architecture as Code</strong> may help Application Architects to be more efficient and effective in communicating architecture to the rest of their teams. Let’s look a the problems.</p><h3>Problem #1 - Complexity</h3><p>Modern Application Architecture can become very complex, with many layers, services, components and technologies. <strong>Diagrams </strong>can get too <strong>crowded</strong> and <strong>hard to understand</strong>, making it <strong>difficult to express the Architecture clearly and effectively</strong>.</p><h4>Solution</h4><ul><li><strong>Modular Architecture Definitions</strong>: <em>define </em><strong><em>architecture in code</em></strong><em>, so that it can be modularised into </em><strong><em>smaller</em></strong><em>, </em><strong><em>manageable components</em></strong><em>, making complex systems easier to understand and manage.</em></li><li><strong>Adaptive Visualisation</strong>: <em>allow users to </em><strong><em>adjust the number of structures and their relationships</em></strong><em> (boxes and lines) they see, and at what </em><strong><em>level of detail</em></strong><em>, when they visualise Application Architecture. Manage complexity by displaying only relevant information based on the </em><strong><em>user’s context</em></strong><em>, </em><strong><em>focus</em></strong><em>, or </em><strong><em>specific task at hand</em></strong><em>.</em></li></ul><h3>Problem #2 - Dynamic and Evolving Architectures</h3><p>Architecture structures change over time. Manually updating diagrams is slow and error-prone, causing <strong>documentation </strong>to<strong> </strong>become <strong>inaccurate </strong>and <strong>outdated</strong>.</p><h4>Solution</h4><ul><li><strong>Continuous Integration/Continuous Deployment (CI/CD) for Architecture</strong>: <em>implement of </em><strong><em>CI/CD pipelines for architecture code</em></strong><em>, managing evolving architecture through automated </em><strong><em>integration</em></strong><em>, and deployment (</em><strong><em>publishing</em></strong><em>) processes.</em></li></ul><h3>Problem #3 - Architecture Model — Code gap</h3><p>There is a mismatch between diagramming and coding tools. Changes in code don’t automatically update diagrams, causing <strong>inconsistencies </strong>between <strong>Architecture representation</strong> and the <strong>actual code</strong>.</p><h4>Solution</h4><ul><li><strong>Code-driven Architecture and Diagrams generation</strong>: <strong><em>generate architecture diagrams</em></strong><em> directly </em><strong><em>from </em></strong><em>metadata in the </em><strong><em>codebase</em></strong><em>, using code analysis and other techniques.</em></li></ul><h3>Problem #4 - Standardisation and Consistency</h3><p><strong>Different </strong>diagramming <strong>tools </strong>and <strong>different </strong>diagram <strong>authors </strong>use <strong>different symbols </strong>and <strong>styles</strong>, leading to <strong>inconsistent documentation</strong>. This can <strong>confuse </strong>and <strong>slow down communication among team members</strong>.</p><h4>Solution</h4><ul><li><strong>Architecture Domain-Specific Languages </strong>(DSLs): <em>create (or adopt existing) </em><strong><em>DSLs for defining architectures </em></strong><em>in code, ensuring </em><strong><em>consistency </em></strong><em>in how architectures are described and understood across tools and teams.</em></li><li><strong>Adopt Standards for Diagramming</strong>: <em>work towards a </em><strong><em>widely adopted standard(s)</em></strong><em> for software architecture diagramming that includes symbols, notation, and abstraction levels, similar to UML.</em></li></ul><h3>Problem #5 - Duplication</h3><p><strong>Different teams</strong> drawing Architecture diagrams at <strong>different times </strong>will inevitably create <strong>different views</strong> of the same Architecture structures and their relationships using slightly <strong>different terminology</strong>. This leads to <strong>duplications </strong>and <strong>confusions</strong>.</p><h4>Solution</h4><ul><li><strong>Architecture Model driven visualisation</strong>: <em>allows for </em><strong><em>generation of architecture diagrams</em></strong><em> for different view points </em><strong><em>from a single Architecture Model</em></strong></li></ul><h3>Problem #6 - Collaboration and Version Control</h3><p>Many diagramming tools have <strong>limited features</strong> for teamwork and <strong>tracking changes over time</strong>, making it <strong>hard to handle updates</strong>, especially with <strong>large or remote teams</strong>.</p><ul><li><strong>Architecture Catalogue</strong>: <em>use it as a </em><strong><em>collaborative platform</em></strong><em> where teams can contribute, share, and discuss architectural </em><strong><em>structures </em></strong><em>and their </em><strong><em>relationships</em></strong><em>.</em></li><li><strong>Version-Controlled Architecture Repositories</strong>: <em>store </em><strong><em>architecture code </em></strong><em>in </em><strong><em>version-controlled repositories</em></strong><em>, enabling collaborative editing, branching, and merging, similar to how source code is managed.</em></li></ul><h3>Problem #7 - Interoperability and Exporting</h3><p>Sharing diagrams between different tools or platforms can lose details, as there’s <strong>no common standard</strong> for diagram formats. This makes it <strong>harder to share and collaborate</strong> on architectural designs.</p><h4>Solution</h4><ul><li><strong>Exportable and Importable Code and Diagram Formats</strong>: <em>Ensure </em><strong><em>architecture code</em></strong><em> and </em><strong><em>diagrams </em></strong><em>are written/published in formats that are </em><strong><em>easily exportable</em></strong><em> and </em><strong><em>importable</em></strong><em> across different tools and platforms, facilitating interoperability.</em></li></ul><h3>Problem #8 - Architecture Analysis</h3><p>Diagramming tools often provide <strong>static representations</strong> that lack interactive capabilities for in-depth analysis. This limitation makes it <strong>difficult to understand</strong> how <strong>changes </strong>in one component might <strong>impact </strong>others, leading to <strong>inefficient planning</strong> and potential <strong>oversights </strong>in managing complex systems.</p><h4>Solution</h4><ul><li><strong>Query Language for Architecture</strong>: <em>Develop (or adopt existing) </em><strong><em>query </em></strong><em>language specifically for </em><strong><em>Architecture as Code</em></strong><em> or </em><strong><em>Architecture Catalogue</em></strong><em>. Users could use this language to ask complex </em><strong><em>questions </em></strong><em>about </em><strong><em>dependencies</em></strong><em>, </em><strong><em>impact of changes</em></strong><em>, and </em><strong><em>architecture dynamics</em></strong><em>, with the tools parsing the architecture to provide results.</em></li></ul><h3>Problem #9 - Alignment between Application and Business Architectures</h3><p>Diagramming tools require users to create <strong>new static diagrams</strong> each time they want to model <strong>new interactions</strong> between different structures, their behaviours, and actors, such as <strong>business processes</strong>. This method leads to significant <strong>duplication </strong>of structures and behaviours across diagrams, making it <strong>cumbersome </strong>to <strong>update</strong>, <strong>maintain</strong>, and <strong>understand </strong>the holistic view of the system. It may also lead to different and <strong>conflicting interpretations</strong> of system structures, their behaviours.</p><h4>Solution</h4><ul><li><strong>Business Process Domain-Specific Languages</strong> (DSLs): <em>create a </em><strong><em>DSLs for expressing Business Processes </em></strong><em>in code. This DSL must allow for </em><strong><em>dynamic linking</em></strong><em> between different </em><strong><em>architectural structures</em></strong><em> and their </em><strong><em>behaviours</em></strong><em>. This would enable users to define a </em><strong><em>single instance</em></strong><em> of a structure or behaviour in Architecture code, and then </em><strong><em>reference it across multiple Business Processes</em></strong><em>, ensuring </em><strong><em>consistency </em></strong><em>and </em><strong><em>reducing duplication</em></strong><em>.</em></li></ul><h3>Conclusion</h3><p>It is important to realise that by documenting Application Architecture with diagrams we are capturing a very <strong>limited number</strong> of “snapshots” of complex Application and Business Architectures by focusing only on a very small number of <strong>viewpoints</strong>.</p><p>I believe that we should start <strong>shifting </strong>from <strong>diagramming</strong> of Application Architecture to <strong>modelling it in code</strong>. And I mean <strong>MODELLING IN CODE</strong>, and <strong>NOT just CODING DIAGRAMS</strong>, which comes with most of the same problems as visual diagramming.</p><p>There are a number of tools out there that allow some Architecture modelling in code:</p><ul><li><a href="https://structurizr.com/">Structurizr</a></li><li><a href="https://github.com/lonely-lockley/archinsight">Archinsight</a></li><li><a href="https://github.com/finos-labs/architecture-as-code/tree/main/calm">FINOS Labs Common Architecture Language Model (CALM)</a></li><li><a href="https://github.com/dwmkerr/architecture-as-code">https://github.com/dwmkerr/architecture-as-code</a></li><li><a href="https://github.com/jsoconno/architectures">https://github.com/jsoconno/architectures</a></li></ul><p>Some of these tools can even generate diagrams from architecture code.</p><p>However, I think many of these tools haven’t managed to make a <strong>complete shift </strong>from <strong>diagramming </strong>to <strong>modelling </strong>architecture (even though it’s all done in code).</p><blockquote>I talk in more details about it in my post — <a href="https://medium.com/@slava.vedernikov/my-journey-to-c4interflow-open-source-architecture-as-code-framework-fc7049672375">My journey to C4InterFlow — Open-Source Architecture as Code Framework</a>.</blockquote><figure><img alt="C4InterFlow — Open-Source Architecture as Code Framework" src="https://cdn-images-1.medium.com/max/180/1*YcRSQPwyAhLqZ2pR_QFoEA.png" /><figcaption><a href="https://www.c4interflow.com/">C4InterFlow</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0650467e24c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My journey to C4InterFlow — Open-Source Architecture as Code Framework]]></title>
            <link>https://medium.com/@slava.vedernikov/my-journey-to-c4interflow-open-source-architecture-as-code-framework-fc7049672375?source=rss-d945b694fa73------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc7049672375</guid>
            <category><![CDATA[application-architecture]]></category>
            <category><![CDATA[diagram-as-code]]></category>
            <category><![CDATA[c4-model]]></category>
            <category><![CDATA[architecture-as-code]]></category>
            <dc:creator><![CDATA[Slava Vedernikov]]></dc:creator>
            <pubDate>Sat, 06 Apr 2024 18:19:44 GMT</pubDate>
            <atom:updated>2024-08-29T09:38:11.606Z</atom:updated>
            <content:encoded><![CDATA[<h3>My journey to C4InterFlow — Open-Source Architecture as Code Framework</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LuawKEnWwLRQKqXHxPp5kA.png" /></figure><p>I’ve been working as a Solution &amp; Application Architect for over 15 years now. Overtime, I’ve learned and sometimes used Architecture frameworks such as <a href="https://www.opengroup.org/togaf">TOGAF</a>, <a href="https://pubs.opengroup.org/architecture/archimate3-doc/">ArchiMate</a> and <a href="https://en.wikipedia.org/wiki/Zachman_Framework">Zachman</a>. I always felt that these frameworks, while very broad and comprehensive, are also a bit overwhelming. What I do like about them though is the fact that they all have very clear metamodels behind them. By trying to understand those metamodels, I’ve learned to see Architecture as a Model.</p><p>A couple of years ago I was introduced to <a href="https://c4model.com/">C4 Model</a>, and my world has changed forever! A bit dramatic, I know :)</p><p>It’s not an Architecture Framework, it’s more of an Application Architecture <strong>Visualisation</strong> Framework, and to be honest architecture visualisation is what Architects mostly do anyway. What I love about C4 Model is its simplicity and practicality. With just four levels of abstraction (or levels of details) — Context, Container, Component and Code, it covers all you need to know to express the <strong>Application</strong> Architecture, and to communicate it effectively to any audience.</p><p>There are quite a <a href="https://c4model.com/#Tooling">number of tools</a> out there that will get you started with C4 Model. Whether you want to <a href="https://c4model.tools/#visual-diagramming-tools">draw C4 diagrams</a>, or <a href="https://c4model.tools/#text-based-diagramming-tools">write diagrams in code</a>, or create an architecture model <a href="https://c4model.tools/#visual-modelling-tools">visually</a> or <a href="https://c4model.tools/#text-based-diagramming-tools">in code</a>, there is a tool for that.</p><p>I personally started with <a href="https://github.com/plantuml-stdlib/C4-PlantUML">C4-PlantUML</a> and then I discovered <a href="https://github.com/8T4/c4sharp">C4 Sharp</a>. I’ve used <a href="https://mermaid.js.org/">Mermaid</a> before, so I was very comfortable with the concept of diagrams as code. Playing with <a href="https://c4model.tools/#visual-diagramming-tools">C4 diagrams as code</a> tools helped me to understand what is really possible with C4 Model, and I got hooked.</p><p>However, I wanted more… I wanted to model architecture with C4 Model like a pro! That’s when I came across <a href="https://structurizr.com/">Structurizr</a> with its own Architecture Model as Code Domain Specific Language (DSL). Initially I thought, that’s it, this is the tool I want to learn and use on a daily basis for Modelling Architecture.</p><p>Over my career as an Architect I’ve drawn countless diagrams, and, I must admit, I enjoyed it at times, especially when I saw the Engineers working with my diagram on their second display, or having a meeting with my diagram projected on the screen. A lot of the times though it’s quite a painful process, and I understand why most people don’t like drawing diagrams. There is constant struggle with lines and boxes and how to align them. There are questions like “Is this the right type of diagram?”, “Have I included enough details?”, “Is it too busy?”, “Do I need to re-draw it for a different audience?” etc.</p><p>With tools like Structurizr you don’t need to worry about most if it anymore; you just focus on “coding” your Architecture Model and Views, and leave the rest to the view (diagram) rendering engine. There was, however, something bothering me… It was the way that Relationships between Structures were modelled. There was something a bit “diagrammy” about it or maybe it wasn’t very “code-like”… Let me explain.</p><p>Imagine a simple ToDo App that has a Web and a Mobile UI, API and a Database. Something like this could be expressed in Structurizr as follows</p><pre>workspace {<br>    model {<br>        user = person &quot;User&quot;<br>        toDoApp = softwareSystem &quot;To Do App&quot; {<br>            database = container &quot;Database&quot;<br>            webapi = container &quot;Web API&quot;<br>            mobileapp = container &quot;Mobile App&quot;<br>            webapp = container &quot;Web App&quot;<br>        }<br>        <br>        user -&gt; mobileapp &quot;View Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;<br>        user -&gt; webapp &quot;View Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;<br>        webapi -&gt; database &quot;Select Tasks\nInsert Task\nUpdate Task\Delete Task&quot;<br>        mobileapp -&gt; webapi &quot;Get Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;<br>        webapp -&gt; webapi &quot;Get Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;<br>    }<br><br>    views {<br>        container toDoApp {<br>            include *<br>            autolayout lr<br>        }<br>        theme default<br>    }<br>}</pre><p>The C4 Container Level view would look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a44AZ4XJyFQ8cQvrppciDQ.png" /></figure><p>C4-PlantUML Diagram as Code for the same ToDo App would look like this</p><pre>@startuml<br>!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml<br>LAYOUT_LEFT_RIGHT()<br><br>Person(user, &quot;User&quot;)<br>System_Boundary(softwareSystem, &quot;To Do App&quot;) {<br>    Container(database, &quot;Database&quot;)<br>    Container(webapi, &quot;Web API&quot;)<br>    Container(mobileapp, &quot;Mobile App&quot;)<br>    Container(webapp, &quot;Web App&quot;)<br>}<br>        <br>Rel(user, mobileapp, &quot;View Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;)<br>Rel(user, webapp, &quot;View Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;)<br>Rel(webapi, database,  &quot;Select Tasks\nInsert Task\nUpdate Task\nDelete Task&quot;)<br>Rel(mobileapp, webapi, &quot;Get Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;)<br>Rel(webapp, webapi, &quot;Get Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;)<br><br>@enduml</pre><p>Which, when rendered as PNG would look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*a2LLtawCV2IFLd3stABDkg.png" /></figure><h4>Correlation between lines of code and lines on the diagram</h4><p>Look how similar the Structurizr code is to C4-PlantUML code. I appreciate that it can be written a bit differently and that would obscure the similarity, so let’s inspect it a bit closer. Take, for example, the Line/Relationship between <strong>Web App </strong>and <strong>Web API</strong>. It shows that <strong>Web App </strong>can use the following <strong>operations </strong>of <strong>Web API</strong>:</p><ul><li>Get Tasks</li><li>Add Task</li><li>Update Task</li><li>Delete Task</li><li>Mark Task as Done</li></ul><p>All of the above are the <strong>distinct operations</strong>, but in Structurizr code as well as C4-PlantUML code they are all expressed on a <strong>single line of code </strong>just because we want them all to appear as a <strong>Label on a single line</strong> on the <strong>Diagram</strong>.</p><p>Look what happens if we re-write a single line relationship like this</p><pre>webapp -&gt; webapi &quot;Get Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;</pre><p>..as five relationships on a separate line each</p><pre>webapp -&gt; webapi &quot;Get Tasks&quot;<br>webapp -&gt; webapi &quot;Add Task&quot;<br>webapp -&gt; webapi &quot;Update Task&quot;<br>webapp -&gt; webapi &quot;Delete Task&quot;<br>webapp -&gt; webapi &quot;Mark Task as Done&quot;    </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*toM3eefhQiAQp6NJxNkYuQ.png" /></figure><p>Five Relationship lines in Structurizr code are now rendered as five lines on the Diagrams.</p><p>In my view a true Architecture Model should not be “coupled” to its Visual representation.</p><h4>Duplicated operations in relationships</h4><p>Now, look at the Relationships between <strong>Web App </strong>and <strong>Web API</strong>, and between <strong>Mobile App </strong>and <strong>Web API</strong>.</p><pre>webapp -&gt; webapi &quot;Get Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;<br>mobileapp -&gt; webapi &quot;Get Tasks\nAdd Task\nUpdate Task\nDelete Task\nMark Task as Done&quot;</pre><p>They are exactly the same, however, because they are essentially duplicated as plain text in code, it would be very easy, especially on a much larger scale to call them different names or simply miss-type them etc. If that happened, then from a Architecture Model perspectives, especially if it was used in some kind of automation, they would be seen as different operations.</p><h4>Interfaces</h4><p>If we were to implement these relationships in code, then this is how it may have looked.</p><pre>public interface IWebAPI {<br> IEnumerable&lt;Task&gt; GetTasks();<br> void AddTask(Task task);<br> void UpdateTask(Task task);<br> void DeleteTask(int taskId);<br> void MarkTaskAsDone(int taskId);<br>}<br><br>public class WebApp {<br> private IWebAPI _webapi;<br> <br> public WebApp(IWebAPI webapi) {<br>  _webapi = webapi;<br> }<br> <br> public void ViewTasks() {<br>  var tasks = _webapi.GetTasks();<br>  ...<br> }<br> <br> public void AddTask(Task task) {<br>  _webapi.AddTask(task);<br> }<br> <br> public void UpdateTask(Task task) {<br>  _webapi.UpdateTask(task);<br> }<br> <br> public void DeleteTask(int taskId) {<br>  _webapi.DeleteTask(taskId);<br> }<br> <br> public void MarkTaskAsDone(int taskId) {<br>  _webapi.MarkTaskAsDone(taskId);<br> }<br>}</pre><p>Notice how all operations of <strong>IWebAPI</strong> are defined explicitly and only once, and then they can be used by <strong>Web App </strong>and in theory by <strong>Mobile App</strong>.</p><p>So, I started thinking, it would be great if Architecture Model allowed expressing the relationships between structures much like we do it in code that implements those relationships.</p><p>Imagine if Structurizr supported code like this</p><pre>workspace {<br>    model {<br>        toDoApp = softwareSystem &quot;To Do App&quot; {<br>            database = container &quot;Database&quot; {<br>                selecttasks = interface &quot;Select Tasks&quot;<br>                inserttask = interface &quot;Insert Task&quot;<br>                updatetask = interface &quot;Update Task&quot;<br>                deletetask = interface &quot;Delete Task&quot;<br>            }<br>            webapi = container &quot;Web API&quot; {<br>                gettasks = interface &quot;Get Tasks&quot; {<br>                    this -&gt; database.selecttasks<br>                }<br>                addtask = interface &quot;Add Task&quot; {<br>                    this -&gt; database.inserttask<br>                }<br>                updatetask = interface &quot;Update Task&quot; {<br>                    this -&gt; database.updatetask<br>                }<br>                deletetask = interface &quot;Delete Task&quot; {<br>                    this -&gt; database.deletetask<br>                }<br>                marktaskasdone = interface &quot;Mark Task as Done&quot; {<br>                    this -&gt; database.updatetask<br>                }<br>            }<br>            mobileapp = container &quot;Mobile App&quot; {<br>                wiewtasks = interface &quot;View Tasks&quot; {<br>                    this -&gt; webapi.gettasks<br>                }<br>                addtask = interface &quot;Add Task&quot; {<br>                    this -&gt; webapi.addtask<br>                }<br>                updatetask = interface &quot;Update Task&quot; {<br>                    this -&gt; webapi.updatetask<br>                }<br>                deletetask = interface &quot;Delete Task&quot; {<br>                    this -&gt; webapi.deletetask<br>                }<br>                marktaskasdone = interface &quot;Mark Task as Done&quot; {<br>                    this -&gt; webapi.marktaskasdone<br>                }<br>            }<br>            webapp = container &quot;Web App&quot; {<br>                wiewtasks = interface &quot;View Tasks&quot; {<br>                    this -&gt; webapi.gettasks<br>                }<br>                addtask = interface &quot;Add Task&quot; {<br>                    this -&gt; webapi.addtask<br>                }<br>                updatetask = interface &quot;Update Task&quot; {<br>                    this -&gt; webapi.updatetask<br>                }<br>                deletetask = interface &quot;Delete Task&quot; {<br>                    this -&gt; webapi.deletetask<br>                }<br>                marktaskasdone = interface &quot;Mark Task as Done&quot; {<br>                    this -&gt; webapi.marktaskasdone<br>                }<br>            }<br>        }<br>    }<br><br>    views {<br>        container toDoApp {<br>            include *<br>            autolayout lr<br>        }<br>        theme default<br>    }<br>}</pre><p>This code has explicit definitions of all Interfaces in all Containers. It also expresses Relationships by showing which other interfaces are being used by each interface. This is very close to the actual code that would implement these relationships.</p><h4>Flows</h4><p>Going back to the code example, it’s very likely that the implementation of any given method would end up using multiple interfaces, and possibly have some logic/control flow, like the code example below.</p><pre>public void AddTask(Task task) {<br>  var tasks = _webapi.GetTasks();<br>  if (!tasks.Any(x =&gt; x.Id == task.Id)) {<br>    _webapi.AddTask(task);<br>  }<br>}</pre><p>So, how do we represent this in the Architecture Model? What if Structurizr supported the following code</p><pre>addtask = interface &quot;Add Task&quot; {<br>  flows {<br>    flow {<br>      type Use<br>      expression &quot;webapi.gettasks&quot;<br>    }<br>    flow {<br>      type If<br>      expression &quot;Task does not exist&quot;<br>      flows {<br>        flow {<br>          type Use<br>          expression &quot;webapi.addtask&quot;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>This would not only still allow to render C4 Model Diagrams, it would also allow to render Sequence Diagrams with alternative flows, which would make it very valuable, as now the logic behind each of the interfaces can be visualised.</p><p>However, Structurizr does not support any of the above, nor do any of the other Architecture as Code projects I looked at:</p><ul><li><a href="https://github.com/lonely-lockley/archinsight">Archinsight</a></li><li><a href="https://github.com/finos-labs/architecture-as-code/tree/main/calm">FINOS Labs Common Architecture Language Model (CALM)</a></li><li><a href="https://github.com/dwmkerr/architecture-as-code">https://github.com/dwmkerr/architecture-as-code</a></li><li><a href="https://github.com/jsoconno/architectures">https://github.com/jsoconno/architectures</a> etc.</li></ul><h4>C4InterFlow was born</h4><p>So, I’ve decided to build my own — <strong>C4InterFlow </strong>(<strong>C4 Inter</strong>faces and <strong>Flow</strong>s).</p><p>The core Vision for C4InterFlow is to <em>“Transform the landscape of </em><strong><em>Application Architecture</em></strong><em> by bridging the </em><strong><em>gap </em></strong><em>between </em><strong><em>Architecture Model</em></strong><em> and </em><strong><em>Code</em></strong><em>.”</em></p><p>That is why C4InterFlow started as a framework focused on generating <strong>Architecture as Code</strong> (AaC) in C# from the <strong>actual Software System’s </strong>C#<strong> source code</strong>, and then using AaC to generate Diagrams for different viewpoints.</p><p>As the C4InterFlow Architecture as Code <strong>C# DSL </strong>matured, I’ve started thinking about adding support for other more widely adopted languages and notations for expressing Architecture as Code like <strong>YAML </strong>and <strong>JSON</strong>.</p><p>Here is how the ToDo App could be described using <strong>C4InterFlow YAML DSL</strong>.</p><pre>ToDoAppExample:<br>  SoftwareSystems:<br>    ToDoApp:<br>      Containers:<br>        Database:<br>          Interfaces:<br>            SelectTasks: {}<br>            InsertTask: {}<br>            UpdateTask: {}<br>            DeleteTask: {}<br>        WebApi:<br>          Interfaces:<br>            GetTasks:<br>              Flows:<br>                - Type: Use<br>                  Expression: Database.Interfaces.SelectTasks<br>            AddTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: Database.Interfaces.InsertTask<br>            UpdateTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: Database.Interfaces.UpdateTask<br>            DeleteTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: Database.Interfaces.DeleteTask<br>            MarkTaskAsDone:<br>              Flows:<br>                - Type: Use<br>                  Expression: Database.Interfaces.UpdateTask<br>        MobileApp:<br>          Interfaces:<br>            ViewTasks:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.GetTasks<br>            AddTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.AddTask<br>            UpdateTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.UpdateTask<br>            DeleteTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.DeleteTask<br>            MarkTaskAsDone:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.MarkTaskAsDone<br>        WebApp:<br>          Interfaces:<br>            ViewTasks:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.GetTasks<br>            AddTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.AddTask<br>            UpdateTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.UpdateTask<br>            DeleteTask:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.DeleteTask<br>            MarkTaskAsDone:<br>              Flows:<br>                - Type: Use<br>                  Expression: WebApi.Interfaces.MarkTaskAsDone</pre><p>This is how the C4 Model Container level diagram would look when rendered using <a href="https://github.com/SlavaVedernikov/C4InterFlow/wiki/Command-Line-Interface-(CLI)">C4InterFlow CLI</a> based on the above AaC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*NzbUfjjsvBe3SSuth1aljg.png" /></figure><p>And here is how the Sequence diagram for <strong>Mobile App</strong>’s <strong>Add Task</strong> Interface would look (notice the alternative flow).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*vw55vTuDUJxveqGv7jjD3w.png" /></figure><p>In fact, just by executing a single CLI command below we can get C4InterFlow to generate 174 diagrams of different <strong>Types</strong>, <strong>Scopes </strong>and <strong>Levels of Details </strong>covering a large number of Application Architecture Viewpoints.</p><pre>C4InterFlow.Cli draw-diagrams --interfaces &quot;ToDoAppExample.SoftwareSystems.*.Containers.*.Interfaces.*&quot; --levels-of-details context container --aac-reader-strategy &quot;C4InterFlow.Automation.Readers.YamlAaCReaderStrategy,C4InterFlow.Automation&quot; --aac-input-paths &quot;.\Diagrams&quot; --output-dir &quot;.\Architecture&quot; --formats png svg</pre><p>Have a look as the complete <a href="https://github.com/SlavaVedernikov/C4InterFlow/tree/master/Samples/ToDoApp">ToDo App Sample</a> where you can explore all the Diagrams.</p><p>You can also browse more samples of various complexity and depth using <a href="https://c4interflow.github.io/architecture-as-code-samples-visualiser/">C4InterFlow Architecture as Code samples visualiser</a>.</p><h4>Conclusion</h4><p>Event though I’ve been working on <a href="https://github.com/SlavaVedernikov/C4InterFlow">C4InterFlow</a> for around 1.5 years, and despite the fact that it is already full of very powerful and in some cases unprecedented features, I still feel that I’m just at the very beginning of my journey to fully unleashing the power of Architecture Model as Code.</p><p>There are opportunities to connect <strong>Application </strong>Architecture with</p><ul><li><strong>Business</strong> Architecture (already partially supported by C4InterFlow with <strong>Actors </strong>and <strong>Business Processes</strong>)</li><li><strong>Data </strong>Architecture (also partially supported by C4InterFlow with <strong>Entities</strong>)</li><li><strong>Infrastructure</strong> Architecture with C4 Model <strong>Deployment </strong>Diagrams.</li></ul><p>Because Architecture as Code is essentially just text, it can be used to fine-tune LLMs and build AI-Powered Chatbots — <strong>Enterprise Architecture Assistants</strong> unique for every organisation. Imagine how empowered and productive everyone in your organisation can be with a tool that can answer any questions about your Systems, Business Processes, Data etc.</p><p>What do you think..? Can this be a future of Enterprise Architecture?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc7049672375" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>