4+1 architectural view model - Wikipedia
In software architecture, such diagrams are created in compliance with views which are related Example of an improper architectural diagram. Even if the line refers to a data flow or a relationship across components, the. Several notations can be combined to describe an architecture - for example, a UML class .. UML building blocks include things, relationships, and diagrams. It is based on diagrammatic representations of software components. For example, activity diagrams, a type of UML diagram, can be used as a . Timing UML diagrams are used to represent the relations of objects when the More specifically, it is used in software development to represent the architecture of the system.
There are multiple factors to take into consideration before making a decision; for example, the nature and the complexity of the architecture, the skills and experience of the software architect, time available, amount of work needed to maintain them, and what makes sense or is useful for meeting stakeholders concerns. For example, a network engineer will probably want to see an explicit network model including hosts, communication ports and protocols; a database administrator is concerned about how the system manipulates, manages and distributes the data, etc.
Based on all of these aspects, it is recommended to pick up the optimal number of diagrams, whatever that number is. If there are insufficient diagrams e.
Entity Relationship Diagram
Keep structural and semantical consistency across diagrams Every diagram should be consistent with the others in terms of boxes, shapes, borders, lines, colors, etc.
The structural look and feel should be the same and every stakeholder should have no difficulties in understanding diagrams created by different developers inside a team. Ideally, stick to a common diagramming tool and reuse it across all projects. From the semantical point of view, all of these diagrams should be periodically synchronized to latest code changes and between them, since a change in one diagram might impact others.
This process might be manually or automatically triggered by using a modeling tool. The latter is the preferred mechanism but this depends from project to project, in all cases the idea is to maintain consistency between diagrams and code, independent of the method or tool. Simon Brown said "diagrams are not useful for architectural improvement if they are not connected to the code", which emphasizes the idea of semantical consistency. Prevent diagrams fragmentation Having multiple diagrams might make the architectural description difficult to understand but also a significant effort in maintaining them.
As a side effect, fragmentation might appear e. In such cases it is recommended to either remove the diagrams which do not reflect relevant quality attributes linked to architecturally significant requirements or, even better, to merge diagrams e. Keep traceability across diagrams To be able to check the history, making comparisons between different diagram versions plus easily reverting to a previous version is also important.
Using a modeling tool which does not allow that might be an impediment. The latest trends in the industry rely on using a simple and intuitive plain text language to generate the diagrams out of it, which seems to solve the traceability concern.
Another advantage of such an approach is that it implicitly ensures a homogeneous structural consistency between diagrams. Add legends next to architectural diagrams If you do not follow a standard architectural description language e. UML, ArchiMatedetail every piece of the diagram in the legend e. If this is not the case, in the legend just add the architectural description language as a key and there is no need for additional explanations, since every reader will follow on that language specifics to understand the diagram.
Does the Architectural Description Language e. There are a lot of opinions regarding which is the right description language to be adopted in the project.UML Use Case Diagram Tutorial
Some people might argue that UML is rigid and not flexible enough to model the architectural design, a point of view which I agree with. Nevertheless, in some cases it might be more than sufficient for documenting the fundamentals of an architecture without relying on any UML extensibility features like profiles and stereotypes.
By taking a look at other description languages, we can see that ArchiMate is more powerful and suitable for modeling enterprise systems in comparison to UML; there is also BPMN which is particularly targeted to business processes, etc.
The comparisons might continue, but I do not intent to make any deep review across them, since this is not the goal of this article. Having an architectural description language comprehensive and flexible enough is a big step forward and this should be a solid criteria when choosing it.
But from my perspective, the real cause resides somewhere else and is related to the fact that architectural documentation is not created at all. People often find creating it boring, useless or pointless. The number of software projects without, or with improper documentation, is huge.
I do not think people are intensively creating or involved in the creation of architectural diagrams using an improper description language, and if they were to replace them with a better one the results would be very different.
No, people are not creating any architectural documentation including architectural diagramsand even worse, most of them have no idea about how to properly create it. These are the things we need to address first- to understand why documentation matters and how to properly create it by training software engineers ; then the selection of proper tools comes naturally.
How can diagrams be kept up-to-date as the system is developed, and changes to the architecture materialize There are few approaches to keeping diagrams updated; below I will express three of them. The first option, and the easiest one, would be to automatically generate diagrams out of the source code, which is the ground truth.
This guarantees they are all consistent to the code. Unfortunately, with existing tools this is not yet fully possible at least to my knowledgesince actual tools cannot create any type of accurate and meaningful diagram only based on the source code, without significant manual intervention.
Len Bass said "the ideal development environment is one for which the documentation is available for essentially free with the push of a button", implicitly auto generating the diagrams, but we have not reached that point. The second approach would be to first design the diagrams using a dedicated tool which then generate the source code skeletons e.
This way, every change in the architecture needs to be triggered from the diagram itself which automatically might regenerate or update the code skeleton. The last case involves manually updating the diagrams every time a new feature - which has an impact on the architectural design - is implemented.
The C4 model for software architecture
To be sure all code changes are reflected in the diagrams, it is recommended that updating diagrams to be part of the definition of done in the development process. This scenario is less recommended because it could easily cause outdated or inconsistent diagrams e.
Taking into account existing tools, my recommendation is to have a mix; to blend automatically and manually create diagrams. For example, try to auto generate diagrams, which can be reasonably rendered by tools based on source code without too much noise e. In this category we can include either diagrams with a high degree of volatility e.
The Art of Crafting Architectural Diagrams
Some such diagrams might refer to context diagrams, reference architecture diagrams, package diagrams, class diagrams, entity diagrams, etc. Nevertheless, in some cases, it is not obvious based only on the source code how the system meets some quality attributes e.
It needs to be complemented by manually modeled diagrams. Some examples of such diagrams include sequence diagrams, state diagrams, concurrency diagrams, deployment diagrams, operational diagrams, etc. What complications or simplifications emerge for architectural diagrams when dealing with modern architectures e. Microservices or any other modern architectural style e. Personally, I don't think the architectural style should change the rationale or concepts around creating the diagrams and implicitly the architectural descriptionneither what they should capture.
Nevertheless, when we talk about modern systems architectures, usually having higher levels of complexities in comparison to old and classical systems e. Such considerations might be in regards to understanding the number of distributed components e.
Taking all of these into account, views capturing system decomposition, development, deployment and operability should be considered by default. Imagine a system with an impressive number of micro-services, for example; in such a case the number of diagrams might significantly increase because each microservice might end up in having its own set of diagrams. Issues regarding consistency e. To summarize, moderns systems with complex architectures might bring additional concerns which could lead to complications even at the diagrams level.
How many people use the C4 model? The honest answer is that nobody knows. Simon has personally taught the C4 model to somewhere over 10, people in more than 30 countries; with conference talks, videos, books and articles reaching many more than this. Other people are also teaching, speaking and writing about the C4 model too. It's definitely being used though, in organisations ranging from startups to global household names. Terms like "process", "application", "app", "server", "deployable unit", etc all have associated implications, so the name "container" was chosen as a generic way to describe something in which components live.
From one perspective, it's unfortunate that containerisation has become popular, because many software developers now associate the term "container" with Docker. From another perspective though, there is sometimes a nice parity between a container in the C4 model and an infrastructure e. While many teams successfully use the C4 model as is, feel free to change the terminology if needed.
Can we change the terminology? This terminology context, containers, components and code works for many organisations and many types of software. However, sometimes an organisation will have an existing terminology that people are already familiar with. Or perhaps "components" and "classes" don't easily map on to the technology being used e.
Feel free to modify the terminology that you use to describe software architecture at different levels of abstraction. Just make sure that everybody explicitly understands it.
How do you model microservices and serverless? Broadly speaking, there are two options for diagramming microservices when using the C4 model. Microservices as software systems: If your software system has a dependency upon a number of microservices that are outside of your control e. On the other hand, if the microservices are a part of a software system that you are building i.
In the same way that a modular monolithic application is a container with a number of components running inside it, a microservice is simply a container with a smaller number of components running inside it.
How do you diagram large and complex software systems? Even with a relatively small software system, it's tempting to try and include the entire story on a single diagram. For example, if you have a web application, it seems logical to create a single component diagram that shows all of the components that make up that web application. Unless your software system really is that small, you're likely to run out of room on the diagram canvas or find it difficult to discover a layout that isn't cluttered by a myriad of overlapping lines.
Using a larger diagram canvas can sometimes help, but large diagrams are usually hard to interpret and comprehend because the cognitive load is too high.
- The C4 model for software architecture
- 4+1 architectural view model
And if nobody understands the diagram, nobody is going to look at it. Instead, don't be afraid to split that single complex diagram into a larger number of simpler diagrams, each with a specific focus around a business area, functional area, functional grouping, bounded context, use case, user interaction, feature set, etc.
The key is to ensure that each of the separate diagrams tells a different part of the same overall story, at the same level of abstraction. See also Diagramming vs modelling for an alternative approach. Will the diagrams become outdated quickly? Due to the hierarchical nature of the C4 model, each diagram will change at a different rate.
In most cases, the system context diagram will change very slowly, as this describes the landscape that the software system is operating within. For any software system under active development, the component diagrams may change frequently as the team adds, removes or restructures the code into cohesive components. Automating the generation of this level of detail with tooling can help.
The level 4 code e. For this reason, the recommendation is to 1 not create them at all or 2 generate them on-demand using tooling such as your IDE. Why doesn't the C4 model cover business processes, workflows, state machines, domain models, data models, etc?
The focus of the C4 model is the static structures that make up a software system, at different levels of abstraction. Often this is because teams don't know these notations well enough, perceive them to be too complicated, think they are not compatible with agile approaches or don't have the required tooling. If you are already successfully using one of these notations to communicate software architecture and it's working, stick with it.
If not, try the C4 model. And don't be afraid to supplement the C4 diagrams with UML state diagrams, timing diagrams, etc if you need to. Can we combine C4 and arc42? Yes, many teams do, and the C4 model is compatible with the arc42 documentation template as follows.
A common misconception is that a team's design process should follow the levels in the C4 model hierarchy, perhaps with different people on the team being responsible for different levels of diagrams. For example, a business analyst creates the system context diagram, the architect creates the container diagram, while the developers look after the remaining levels of detail.
Although you can certainly use the C4 model in this way, this is not the intended or recommended usage pattern. The C4 model is just a way to describe a software system, from different levels of abstraction, and it implies nothing about the process of delivering software.
Using C4 to describe libraries, frameworks and SDKs? The C4 model is really designed to model a software system, at various levels of abstraction.