C4 Model - JU-DEV-Bootcamps/ERAS GitHub Wiki
C4 Model
The C4 model is a modern, structured approach to visualizing and documenting the architecture of software systems. It was introduced by Simon Brown to address the challenges of effectively communicating software designs among developers, architects, and stakeholders. The model emphasizes simplicity, hierarchy, and clarity.
Diagrams
The C4 model consists of four hierarchical levels of diagrams:
1. Context Diagram
This diagram provides a high-level view of the software system, illustrating how it fits into its environment. It identifies the system's external entities (e.g., users, external systems) and the relationships between them.
Example Elements:
- System being designed
- External systems
- Primary user roles
2. Container Diagram
The container diagram breaks down the system into its major building blocks, called containers. A container can be a web application, mobile app, database, or any other deployable unit of software.
Example Elements:
- Web applications
- APIs
- Databases
3. Component Diagram
This diagram zooms into an individual container to show its internal components. Components are functional building blocks, such as classes, services, or modules.
Example Elements:
- Service classes
- Controllers
- Data access objects (DAOs)
4. Code Diagram (Optional)
This is the most detailed level, providing a close-up view of the source code. It typically includes UML class diagrams or other low-level representations.
Example Elements:
- Classes
- Interfaces
- Relationships
Benefits of the C4 Model
- Clarity: The hierarchical structure helps to present information at the right level of detail for different audiences.
- Collaboration: Serves as a common language between technical and non-technical stakeholders.
- Scalability: Works well for both small and large systems by providing varying levels of granularity.
- Simplicity: Focuses on communicating ideas effectively without overloading diagrams with unnecessary details.
Best Practices for Using the C4 Model
- Iterate Over Time: Start with a context diagram and refine details in the subsequent levels as the design evolves.
- Use Consistent Notation: Standardize symbols and layouts to maintain clarity across diagrams.
- Leverage Tools: Use tools like Structurizr, PlantUML, or Draw.io to create and maintain diagrams.
- Integrate with Documentation: Include C4 diagrams in architecture documentation to provide a comprehensive view of the system.
- Engage Stakeholders: Regularly review diagrams with team members to ensure accuracy and relevance.
Tools Supporting the C4 Model
- Structurizr: Purpose-built for C4 diagrams, supporting collaborative and cloud-based modeling.
- PlantUML: Allows textual definitions of C4 diagrams for integration into version control systems.
- Draw.io: Versatile diagramming tool suitable for manual creation of C4 diagrams.
- Lucidchart: Offers a user-friendly interface for diagramming with support for collaboration.
C4 Model Definition - ERAS
The next diagrams are made to show the system architecture for ERAS project.