<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Weidmann</title>
    <description>The latest articles on DEV Community by Michael Weidmann (@michaelweidmann).</description>
    <link>https://dev.to/michaelweidmann</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F571618%2F48a7db5e-1bfe-4135-b3e8-cd69dd7cbee3.png</url>
      <title>DEV Community: Michael Weidmann</title>
      <link>https://dev.to/michaelweidmann</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/michaelweidmann"/>
    <language>en</language>
    <item>
      <title>Remote debugging of Java apps in Kubernetes</title>
      <dc:creator>Michael Weidmann</dc:creator>
      <pubDate>Thu, 15 Sep 2022 09:36:17 +0000</pubDate>
      <link>https://dev.to/devlix-blog/remote-debugging-of-java-apps-in-kubernetes-2mo</link>
      <guid>https://dev.to/devlix-blog/remote-debugging-of-java-apps-in-kubernetes-2mo</guid>
      <description>&lt;p&gt;"It works on my machine ¯_(ツ)_/¯" - the older generation of developers often used this phrase in daily life. With Docker and Kubernetes there are platforms that solve such problems today. &lt;/p&gt;

&lt;p&gt;But don’t be too happy about it: sometimes your application does not do what was implemented and tested locally. An experienced developer would turn on the debugger in such a case, but is that so easy on a Kubernetes cluster? Yes, and we'll show you exactly how in this blog post!&lt;/p&gt;

&lt;p&gt;For the sake of simplicity, we will use the IntelliJ development environment throughout this post, but that should not be a big limitation - other development environments offer similar features.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concept
&lt;/h2&gt;

&lt;p&gt;The underlying idea is to enable debugging on a port in the Kubernetes pod (in which the Java app is running). This port must be exposed by the Pod.&lt;/p&gt;

&lt;p&gt;Afterwards, a local port must be forwarded to the open debugging port of the pod using &lt;a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/#forward-a-local-port-to-a-port-on-the-pod" rel="noopener noreferrer"&gt;Port Forwarding&lt;/a&gt;. Last but not least, JVM Remote Debugging must be started in the development environment with the forwarded local port. The following diagram shows the structure of remote debugging in a Kubernetes cluster:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frw59aac18fdfcbkgtb99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frw59aac18fdfcbkgtb99.png" alt="Concept" width="800" height="140"&gt;&lt;/a&gt;&lt;/p&gt;
 Figure 1: The concept of remote debugging in a Kubernetes cluster



&lt;h2&gt;
  
  
  Step 0: Setting up JVM remote debugging in IntelliJ
&lt;/h2&gt;

&lt;p&gt;The first step is to set up remote debugging in IntelliJ. To do this, open please the configuration window for &lt;code&gt;Run Configurations&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F005md6a4pc3bznljlo5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F005md6a4pc3bznljlo5i.png" alt="Editing Run Configurations" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;
Figure 2: New "Remote JVM Debug" Run Configuration
 



&lt;ol&gt;
&lt;li&gt;Create a new &lt;code&gt;Run Configuration&lt;/code&gt; by clicking on the plus symbol in the upper left corner and selecting &lt;code&gt;Remote JVM Debug&lt;/code&gt; from the list.&lt;/li&gt;
&lt;li&gt;Then you can give the configuration any name you like.&lt;/li&gt;
&lt;li&gt;The standard configuration usually does not need to be adjusted. If the default port 5005 is used elsewhere in your application, you can change it in the configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Now copy the command line arguments&lt;/strong&gt;, they will be needed in the next step.&lt;/li&gt;
&lt;li&gt;Finally, save the configuration, because you will need it later.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Enable debugging in the remote JVM
&lt;/h2&gt;

&lt;p&gt;We usually package our applications in Docker Images, which we build with such a Dockerfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM eclipse-temurin:17-alpine

ARG ARTIFACT
COPY $ARTIFACT app.jar

ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app.jar"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Important is the variable &lt;code&gt;$JAVA_OPTS&lt;/code&gt; in the &lt;code&gt;ENTRYPOINT&lt;/code&gt;. We use this to insert the previously copied command line arguments. We do this by adapting the deployment resource in Kubernetes. With &lt;code&gt;kubectl get deployments&lt;/code&gt; you can display a list of your deployments and with &lt;code&gt;kubectl edit deployment &amp;lt;DEPLOYMENT_NAME&amp;gt;&lt;/code&gt; you can adjust the deployment as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spec:
  containers:
    - ...
      env:
        - name: JAVA_OPTS
          value: &amp;lt;COPIED_JAVA_OPTS&amp;gt;
      ports:
        - name: remotedebugging
          containerPort: &amp;lt;PORT&amp;gt;
          protocol: TCP
      ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;&amp;lt;COPIED_JAVA_OPTS&amp;gt;&lt;/code&gt; with the copied command line arguments from IntelliJ.&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;&amp;lt;PORT&amp;gt;&lt;/code&gt; with the port you use for debugging, in our case &lt;code&gt;5005&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you have done this, you can close the editor and Kubernetes starts a new deployment for you. You can check this with the command &lt;code&gt;kubectl get pods&lt;/code&gt;. A new pod should have been created. Important for the next step: &lt;strong&gt;Copy the name of the pod!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Port Forwarding
&lt;/h2&gt;

&lt;p&gt;After the Pod has been restarted, the debugging port of the Pod must be forwarded to your local machine. This can be done with the following command: &lt;code&gt;kubectl port-forward &amp;lt;POD_NAME&amp;gt; &amp;lt;LOCAL_PORT&amp;gt;:&amp;lt;POD_PORT&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;POD_NAME&amp;gt;&lt;/code&gt; is the name of the pod you should have copied in the previous step.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;LOCAL_PORT&amp;gt;&lt;/code&gt; must be replaced with the port used locally for forwarding and to which the development environment connects for debugging.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;POD_PORT&amp;gt;&lt;/code&gt; is the port you opened in the deployment configuration in the previous step.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: Happy Debugging!
&lt;/h2&gt;

&lt;p&gt;Finally, the debugging configuration created in Step 0 must be started and the following message should appear: &lt;code&gt;Listening for transport dt_socket at address: 5005&lt;/code&gt;. 🎉&lt;/p&gt;

&lt;p&gt;Now you can set breakpoints and find some bugs!&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/#forward-a-local-port-to-a-port-on-the-pod" rel="noopener noreferrer"&gt;Use Port Forwarding to Access Applications in a Cluster&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jetbrains.com/help/idea/tutorial-remote-debug.html#9886af44" rel="noopener noreferrer"&gt;Tutorial: Remote debug | IntelliJ IDEA&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Michael Weidmann is writing for the devlix Blog at &lt;a href="https://www.devlix.de/blog" rel="noopener noreferrer"&gt;https://www.devlix.de/blog&lt;/a&gt;&lt;br&gt;
This article was published first here (german): &lt;a href="https://www.devlix.de/remote-debugging-von-java-apps-in-kubernetes/" rel="noopener noreferrer"&gt;https://www.devlix.de/remote-debugging-von-java-apps-in-kubernetes/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmqebdbqusql1ibky1lr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmqebdbqusql1ibky1lr.png" alt="devlix logo" width="200" height="59"&gt;&lt;/a&gt;&lt;/p&gt;
devlix GmbH: quality, consulting, development



</description>
      <category>kubernetes</category>
      <category>java</category>
      <category>debugging</category>
      <category>docker</category>
    </item>
    <item>
      <title>The four C’s of software architecture</title>
      <dc:creator>Michael Weidmann</dc:creator>
      <pubDate>Mon, 01 Feb 2021 17:36:40 +0000</pubDate>
      <link>https://dev.to/devlix-blog/the-four-c-s-of-software-architecture-p0f</link>
      <guid>https://dev.to/devlix-blog/the-four-c-s-of-software-architecture-p0f</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;It’s the little details that are vital. Little things make big things happen.&lt;/em&gt;&lt;br&gt;
- John Wooden&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The Egyptian pyramids: Seen in the big picture, they are a masterpiece of architecture; seen in detail, they are only small stones placed one on top of the other. Software is typically also composed of small units. To create a good overall picture, the small components must harmonize well with each other.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many people in the software industry are familiar with the following situation: Ideas for a software architecture are collected, discussed, various approaches are visualized on a whiteboard or flipchart, and an architecture is agreed together. As a protocol of the meetings, the visualized architecture is photographed and saved in a wiki tool for the future.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F68u9i8s5cn82bouuj784.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F68u9i8s5cn82bouuj784.png" alt="Picture of a Whiteboard" width="800" height="606"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;b&gt;Figure 1:&lt;/b&gt; Result of the architecture sessions (© Simon Brown, 2021, &lt;a&gt;https://c4model.com/&lt;/a&gt;)
 



&lt;p&gt;A few weeks later, a new employee joins the project and wants to get a rough overview of what the software is about and how it is actually structured (or an employee returning after vacation 😉). This task is not easy, because sometimes labels on arrows are missing and same symbols are used for different elements of the architecture. For this reason, the employee asks the responsible software architect, who, however, does not really remember the individual details either.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion 1:&lt;/strong&gt; The architecture diagram does not by itself provide the information needed for a basic understanding (in the best case more than just that). There is simply no general standard for modeling software architectures.&lt;/p&gt;

&lt;p&gt;In a different situation an existing software requires a new feature, which is associated with architectural changes. Due to the non-uniform and unclear way of documentation, the concrete changes are difficult to represent. Thus, valuable time can be lost by first having to reconstruct the architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion 2:&lt;/strong&gt; Changes to the architecture are always time-consuming with such a documentation style.&lt;/p&gt;

&lt;h2&gt;
  
  
  A short excursion into other industries
&lt;/h2&gt;

&lt;p&gt;In other industries, such as building architecture or electronics, such modeling activities are largely standardized. Standards exist for the individual circuit symbols in electrical circuits, such as &lt;a href="https://std.iec.ch/iec60617" rel="noopener noreferrer"&gt;IEC 60617&lt;/a&gt;. In addition, abstract models exist for different views of a circuit diagram, which can be viewed &lt;a href="https://testguy.net/content/366-Electrical-Drawings-and-Schematics-Overview" rel="noopener noreferrer"&gt;here&lt;/a&gt;. It is important to mention that these models are actually used in practice!&lt;/p&gt;

&lt;p&gt;It would be nice if standards of this kind existed for software architectures. A few important requirements for this would be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Outsiders should understand the architecture as simply as possible by looking at the diagram&lt;/li&gt;
&lt;li&gt;Use of uniform and simple terminology and symbols&lt;/li&gt;
&lt;li&gt;Different views of the software so that each stakeholder has a suitable overview over the software&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last point can be compared to a map that you zoom into (see figure 2). This allows to map different levels of detail of the architecture. This is required for different stakeholders of the software.&lt;/p&gt;

&lt;p&gt;For example, a software developer needs a much deeper insight into the architecture than a colleague from sales.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fibd2720ltbifn7rj0md4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fibd2720ltbifn7rj0md4.jpg" alt="Pictures of maps zooming into one place" width="800" height="589"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;b&gt;Figure 2:&lt;/b&gt; Different levels of abstraction of a place on a map (Base map and data from OpenStreetMap and OpenStreetMap Foundation, © OpenStreetMap contributors, 2021, &lt;a&gt;https://www.openstreetmap.org/copyright/en&lt;/a&gt;)
 



&lt;h2&gt;
  
  
  But UML is a standard, isn’t it?
&lt;/h2&gt;

&lt;p&gt;Absolutely correct. &lt;a href="https://www.uml.org/" rel="noopener noreferrer"&gt;UML&lt;/a&gt; (Unified Modeling Language) is a standardized modeling language whose goal is to specify, design and document software systems. UML is known to many people and some of them in the software industry have already had to deal with it. Various diagrams can be mapped with UML. Here is a small and incomplete list (taken from &lt;a href="https://www.visual-paradigm.com/guide/uml-unified-modeling-language/overview-of-the-14-uml-diagram-types/" rel="noopener noreferrer"&gt;here&lt;/a&gt;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Behavioral diagrams:

&lt;ul&gt;
&lt;li&gt;Activity diagram&lt;/li&gt;
&lt;li&gt;Use Case diagram&lt;/li&gt;
&lt;li&gt;Sequence diagram&lt;/li&gt;
&lt;li&gt;State machine diagram&lt;/li&gt;
&lt;li&gt;…&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Structural diagrams:

&lt;ul&gt;
&lt;li&gt;Class diagram&lt;/li&gt;
&lt;li&gt;Object diagram&lt;/li&gt;
&lt;li&gt;Deployment diagram&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;A good survey of the different types of UML diagrams can be found &lt;a href="https://tallyfy.com/uml-diagram/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;UML is very interesting and some diagrams are wonderful for modeling ideas graphically! Small class diagrams representing a design pattern is a good use case for a UML diagram, because classes, interfaces, inheritances, data and behavior can be easily represented in UML.&lt;/p&gt;

&lt;p&gt;However, to visualize the whole application architecture with UML, different diagrams would have to be drawn and brought together. This costs time and can be very confusing under certain circumstances with large architectures. In addition, the diagrams may cause confusion for people without a technical background, as they are not familiar with the notation. We can and should use UML, but for the situations it should be used for: to describe design patterns and small parts of an application in detail.&lt;/p&gt;

&lt;p&gt;But how can we then describe software architectures?&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution: The C4 model
&lt;/h2&gt;

&lt;p&gt;In 2006, &lt;a href="https://simonbrown.je/" rel="noopener noreferrer"&gt;Simon Brown&lt;/a&gt; developed a simple and comparatively easy way to describe software architectures. In principle, this works analogously as shown in figure 2 with the map. There are four different “zoom levels” of the architecture (this also explains the name 😉):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;System &lt;strong&gt;C&lt;/strong&gt;ontext&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;C&lt;/strong&gt;ontainer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;C&lt;/strong&gt;omponents&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;C&lt;/strong&gt;ode&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before looking at the individual levels in a little more detail, it is important to agree on a common abstraction. This is also used again afterwards in the charts. The following list provides a &lt;strong&gt;brief&lt;/strong&gt; overview:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Person:&lt;/strong&gt; A human or group of humans interacting with a system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Software System:&lt;/strong&gt; A software system is the highest level of abstraction and describes something that provides value to its users (both human and technical). The software being modeled and other systems on which the software system depends are included.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Container:&lt;/strong&gt; Not Docker! In the C4 model, this means individual applications or data stores. Typically, they are individually deployable/executable units. (Examples: a Spring Boot application, a PostgreSQL database, …).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Component:&lt;/strong&gt; Just like container, this term can have many meanings. In the C4 context, a component is a grouping of related functionalities behind a defined interface. Unlike containers, components cannot be executed individually. Example: A REST controller from Spring Boot is a component.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deeper explanations and explanations can be read on the &lt;a href="https://c4model.com/#Abstractions" rel="noopener noreferrer"&gt;official site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It is important to mention that the C4 model merely describes &lt;strong&gt;how&lt;/strong&gt; an architecture should be described in an understandable way. The model does not describe a process or a notation. However, there is an official proposal for the &lt;a href="https://c4model.com/#Notation" rel="noopener noreferrer"&gt;notation&lt;/a&gt;, which is used in the following subchapters.&lt;/p&gt;

&lt;p&gt;The following subchapters provide a brief insight into the different abstraction levels, which can be read in more detail &lt;a href="https://c4model.com/#CoreDiagrams" rel="noopener noreferrer"&gt;here&lt;/a&gt;. This is accompanied by an example from the &lt;a href="https://c4model.com/#CoreDiagrams" rel="noopener noreferrer"&gt;official site&lt;/a&gt;, in which an online banking system is modeled graphically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 1: System Context
&lt;/h3&gt;

&lt;p&gt;This diagram shows the overview of a &lt;strong&gt;software system&lt;/strong&gt; with all interactions. Not only user interactions are meant, but also external software systems. The target audience of the diagram is not only the developer of the software, but also outsiders.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftoy710kj7jxqyncnzblz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftoy710kj7jxqyncnzblz.png" alt="System Context Diagram of a Banking System" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;b&gt;Figure 3:&lt;/b&gt; System Context Diagram of a Banking System (© Simon Brown, 2021, &lt;a&gt;https://c4model.com/&lt;/a&gt;)
 



&lt;p&gt;Figure 3 shows an example of a System Context diagram. In the center you can see the software system, which is describes. Around the outside the people and external software systems involved are shown and how the components relate to each other.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 2: Container
&lt;/h3&gt;

&lt;p&gt;At this level, a view is taken into the system which is described in this example. The individual elements of the system are described at a high level with &lt;strong&gt;containers&lt;/strong&gt;. If relevant, external persons and systems can also be mapped.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flc4w6kqpcgyddkg3s9ss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flc4w6kqpcgyddkg3s9ss.png" alt="Container Diagram of a Banking System" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;b&gt;Figure 4:&lt;/b&gt; Container Diagram of a Banking System (© Simon Brown, 2021, &lt;a&gt;https://c4model.com/&lt;/a&gt;)
 



&lt;p&gt;Figure 4 shows a container diagram. Each container is an autonomously executable unit. Rough technological decisions can be documented at this level.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 3: Component
&lt;/h3&gt;

&lt;p&gt;The penultimate level considers the individual containers from the second level separately and divides them into &lt;strong&gt;components&lt;/strong&gt;. This view is comparable to a &lt;a href="https://www.visual-paradigm.com/guide/uml-unified-modeling-language/what-is-package-diagram/" rel="noopener noreferrer"&gt;package diagram&lt;/a&gt; from UML. The banking example can be viewed &lt;a href="https://c4model.com/img/bigbankplc-Components.png" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 4: Code
&lt;/h3&gt;

&lt;p&gt;The last level considers the components defined from level 3 individually. Usually class diagrams or Entity-Relationship-Diagrams are located at this level. Often this level is considered optional, since such a deep level is not necessary for a rough understanding of an architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  C4-Model vs. UML
&lt;/h2&gt;

&lt;p&gt;In our view, the C4 model and UML must not be contrasted; both pursue different goals and have their reason for existence. While the C4 model describes how a concrete system architecture can be documented in a way that is easy to understand, UML focuses on a uniform notation and a wide range of diagrams. In fact, we find that the diagrams resulting from the C4 model should be supplemented with UML diagrams if necessary, because the four diagrams do not represent a complete architecture documentation under any circumstances! If you are a fan of UML, the C4 diagrams can be mapped with modified UML notation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing words
&lt;/h2&gt;

&lt;p&gt;The C4 model has definitely convinced us and we will use it again — if it fits. In one of our projects, a colleague was able to familiarize himself with the architecture we had changed without much effort after taking parental leave.&lt;br&gt;
We like using the standardized and lightweight model to design architectures efficiently and to document them in a way that is understandable for all target groups. A big advantage is the integration of the C4 model with &lt;a href="https://arc42.org/" rel="noopener noreferrer"&gt;arc42&lt;/a&gt;, &lt;a href="https://www.archimatetool.com/" rel="noopener noreferrer"&gt;ArchiMate&lt;/a&gt; and other tools. We have used &lt;a href="https://app.diagrams.net/" rel="noopener noreferrer"&gt;draw.io&lt;/a&gt; with an &lt;a href="https://github.com/kaminzo/c4-draw.io" rel="noopener noreferrer"&gt;extension&lt;/a&gt; so far and have been satisfied with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related articles/videos
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://c4model.com/" rel="noopener noreferrer"&gt;Official C4 Model Website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/x2-rSnhpw0g"&gt;
&lt;/iframe&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/better-programming/modeling-software-architecture-with-c4-243eb1f240c7" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afill%3A64%3A64%2F2%2AjI2qJ16rxG484VUTCl9YFA.jpeg" alt="Jakub Kapuscik"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/better-programming/modeling-software-architecture-with-c4-243eb1f240c7" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Modeling Software Architecture With C4 | by Jakub Kapuscik | Better Programming&lt;/h2&gt;
      &lt;h3&gt;Jakub Kapuscik ・ &lt;time&gt;Jan 31, 2025&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fmedium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Michael Weidmann is writing for the devlix Blog at &lt;a&gt;&lt;/a&gt;&lt;a href="https://www.devlix.de/blog" rel="noopener noreferrer"&gt;https://www.devlix.de/blog&lt;/a&gt;&lt;br&gt;
This article was published first here (german): &lt;a&gt;&lt;/a&gt;&lt;a href="https://www.devlix.de/die-vier-cs-der-softwarearchitektur/" rel="noopener noreferrer"&gt;https://www.devlix.de/die-vier-cs-der-softwarearchitektur/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsio9uo8z8zz6xmvtyhvl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsio9uo8z8zz6xmvtyhvl.png" alt="Devlix Logo" width="200" height="59"&gt;&lt;/a&gt;&lt;/p&gt;
devlix GmbH: quality, consulting, development
 



</description>
      <category>architecture</category>
      <category>modelling</category>
      <category>c4model</category>
      <category>software</category>
    </item>
  </channel>
</rss>
