C4 model introduce

how to use

install java

install graphviz

brew install graphviz

install vscode plugin PlantUML

https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml

create diagram

https://github.com/plantuml-stdlib/C4-PlantUML

@startuml C4_Elements
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

Person(personAlias, "Label", "Optional Description")
Container(containerAlias, "Label", "Technology", "Optional Description")
System(systemAlias, "Label", "Optional Description")

Rel(personAlias, containerAlias, "Label", "Optional Technology")
@enduml

์ด๋Ÿฐ ๊ทธ๋ฆผ์ด ๋‚˜์˜จ๋‹ค.

@startuml Basic Sample
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

Person(admin, "Administrator")
System_Boundary(c1, "Sample System") {
    Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines")
}
System(twitter, "Twitter")

Rel(admin, web_app, "Uses", "HTTPS")
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
@enduml

code snippet

https://github.com/plantuml-stdlib/C4-PlantUML/blob/master/.vscode/C4.code-snippets

์ด๊ฑธ ๋‹ค์šด๋ฐ›์•„์„œ vscode์— ์—ฐ๊ฒฐํ•ด์ค€๋‹ค.

๋‚˜๋Š” ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์—๋งŒ ์‚ฌ์šฉํ•˜๋ ค๊ณ  .vscode/C4.code-snippets์— ๋„ฃ์–ด์ฃผ์—ˆ๋‹ค.

๊ฐœ๋…

https://modeling.com/

4๊ฐ€์ง€ ๊ด€์ ์˜ ๊ทธ๋ฆผ์ด ์žˆ๋‹ค.

  • System Context

  • Container

  • Component

  • Code

Level

  • ์„œ๋กœ ๋‹ค๋ฅธ ๊ด€์‹ฌ์„ ๊ฐ€์ง„ ๋‹ค์ด์–ด๊ทธ๋žจ ๋ฐ ๋ฌธ์„œ์— ๋Œ€ํ•œ ๋‹ค์–‘ํ•œ ์ฒญ์ค‘์ด ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์†Œํ”„ํŠธ์›จ์–ด ์•„ํ‚คํ…์ฒ˜ ๋‹ค์ด์–ด๊ทธ๋žจ์„ ๊ทธ๋ฆด ๋•Œ ์†Œํ”„ํŠธ์›จ์–ด ๊ฐœ๋ฐœ์ž์ฒ˜๋Ÿผ ์ƒ๊ฐํ•˜์‹ญ์‹œ์˜ค.

  • ๊ณตํ†ต๋œ ์ถ”์ƒํ™” ์ง‘ํ•ฉ์ด ๊ณตํ†ต ํ‘œ๊ธฐ๋ฒ•๋ณด๋‹ค ๋” ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.

  • ์†Œํ”„ํŠธ์›จ์–ด ์‹œ์Šคํ…œ์€ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ฝ”๋“œ ์š”์†Œ์— ์˜ํ•ด ์ฐจ๋ก€๋กœ ๊ตฌํ˜„๋˜๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ๊ฐ๊ฐ ํฌํ•จํ•˜๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ์ปจํ…Œ์ด๋„ˆ๋กœ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค.

Level 1: System Context Diagram

A System Context diagram provides a starting point, showing how the software system in scope fits into the world around it.

System Context diagram์€ ๋ฒ”์œ„์˜ ์†Œํ”„ํŠธ์›จ์–ด ์‹œ์Šคํ…œ์ด ์ฃผ๋ณ€ ์„ธ๊ณ„์— ์–ด๋–ป๊ฒŒ ๋งž๋Š”์ง€ ๋ณด์—ฌ์ฃผ๋Š” ์‹œ์ž‘์ ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

Level 2: Container Diagram

A Container diagram zooms into the software system in scope, showing the high-level technical building blocks.

Container diagram์€ ๋ฒ”์œ„ ๋‚ด์—์„œ ์†Œํ”„ํŠธ์›จ์–ด ์‹œ์Šคํ…œ์„ ํ™•๋Œ€ํ•˜์—ฌ ๋†’์€ ์ˆ˜์ค€์˜ ๊ธฐ์ˆ  ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

Level 3: Component Diagram

A Component diagram zooms into an individual container, showing the components inside it.

Component diagram์€ ๊ฐœ๋ณ„ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ํ™•๋Œ€ํ•˜์—ฌ ๊ทธ ์•ˆ์˜ ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

Level 4: Code Diagram

A code (e.g. UML class) diagram can be used to zoom into an individual component, showing how that component is implemented.

code diagram์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐœ๋ณ„ ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ํ™•๋Œ€ํ•˜์—ฌ ํ•ด๋‹น ๊ตฌ์„ฑ ์š”์†Œ๊ฐ€ ๊ตฌํ˜„๋˜๋Š” ๋ฐฉ๋ฒ•์„ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ธฐ๋ฅผ ์ถ”์ฒœํ•˜์ง€ ์•Š์œผ๋ฉฐ ์ž๋™์œผ๋กœ ์ฝ”๋“œ์—์„œ ์ƒ์„ฑํ•˜๋Š”๊ฑธ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค.

misc

titles

short and meaningful, include the diagram type, numbered if diaram order is important; for example:

์งง๊ณ  ์˜๋ฏธ ์žˆ๋Š” ๋‹ค์ด์–ด๊ทธ๋žจ ์œ ํ˜•์„ ํฌํ•จ ์˜ˆ๋ฅผ ๋“ค์–ด:

system context diagram for finalcial risk system
[system Context] Financial Risk System

๋‹ค์ด์–ด๊ทธ๋žจ ์ˆœ์„œ๊ฐ€ ์ค‘์š”ํ•œ ๊ฒฝ์šฐ ๋ฒˆํ˜ธ๊ฐ€ ๋งค๊ฒจ์ง‘๋‹ˆ๋‹ค.

layout

sticky notes and indexs card( e.g crc cards) make a great substitute for hand-drawn boxes, especially if you dont have a whiteboard

์Šคํ‹ฐ์ปค ๋ฉ”๋ชจ ๋ฐ ์ƒ‰์ธ ์นด๋“œ(์˜ˆ: crc ์นด๋“œ)๊ฐ€ ์†์œผ๋กœ ๊ทธ๋ฆฐ ์ƒ์ž๋ฅผ ๋Œ€์‹ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

visual consistency

try to be consistent with notation and element positioning across diagrams

๋‹ค์ด์–ด๊ทธ๋žจ ์ „์ฒด์—์„œ ํ‘œ๊ธฐ๋ฒ• ๋ฐ ์š”์†Œ ์œ„์น˜์™€ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•˜์‹ญ์‹œ์˜ค.

acronyms(์ค„์ž„๋ง)

๋งค์šฐ ์ฃผ์˜ํ•˜์ž.

be ware of using acronyms, especially those related to the business/domain that you work in

ํŠนํžˆ ๋‹น์‹ ์ด ์ผํ•˜๋Š” ๋น„์ฆˆ๋‹ˆ์Šค/๋„๋ฉ”์ธ๊ณผ ๊ด€๋ จ๋œ ์ค„์ž„๋ง์„ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์š”. ์ƒˆ๋กœ ์กฐ์ธํ•˜๋Š” ์‚ฌ๋žŒ์€ ๋ฐ”๋กœ ์ดํ•ดํ• ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

element

start with simple boxes containing the element name, type, technology (if appropriate) and a description/responsibilities

์š”์†Œ ์ด๋ฆ„, ์œ ํ˜•, ๊ธฐ์ˆ (ํ•ด๋‹น๋˜๋Š” ๊ฒฝ์šฐ) ๋ฐ ์„ค๋ช…/์ฑ…์ž„์ด ํฌํ•จ๋œ ๊ฐ„๋‹จํ•œ ์ƒ์ž๋กœ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

๋ฐ•์Šค๋“ค ํ‘œ์‹œ

์™ผ์ชฝ์ฒ˜๋Ÿผํ•˜์ง€๋ง๊ณ  ์˜ค๋ฅธ์ชฝ์ฒ˜๋Ÿผ ์ž์„ธํ•œ ๋‚ด์šฉ์„ ๋‹ค์ด์–ด๊ทธ๋žจ์— ์“ฐ์ž.

lines

favour uni-directional lines showing the most important dependencies or data flow with an annotation to be explicit about the purpose of the lines and direction

๊ฐ€์žฅ ์ค‘์š”ํ•œ ์ข…์†์„ฑ ๋˜๋Š” ๋ฐ์ดํ„ฐ ํ๋ฆ„์„ ๋ณด์—ฌ์ฃผ๋Š” ๋‹จ๋ฐฉํ–ฅ ๋ผ์ธ์„ ์„ ํ˜ธํ•˜๋ฉฐ ๋ผ์ธ๊ณผ ๋ฐฉํ–ฅ์˜ ๋ชฉ์ ์„ ๋ช…์‹œํ•˜๋Š” ์ฃผ์„์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

summarise the intent of the relationship

๊ด€๊ณ„์˜ ์˜๋„ ์š”์•ฝ

summarise, yet be specific

์š”์•ฝํ•˜๋˜ ๊ตฌ์ฒด์ ์œผ๋กœ

show both directions when the intents are differnt

์˜๋„๊ฐ€ ๋‹ค๋ฅธ ๊ฒฝ์šฐ ์–‘๋ฐฉํ–ฅ ํ‘œ์‹œ

beware of hiding the true story

์ด๋Ÿฐ๊ทธ๋ฆผ์ด๋ฉด ๋งž๋Š” ๋‚ด์šฉ์ด๊ธฐ๋Š” ํ•˜๋‚˜ ์ค‘์š”ํ•œ ๋‚ด์šฉ์„ ์ˆจ๊ธธ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ๊ทธ๋ฆฌ๋ฉด ์ข€๋” ๋ช…ํ™•ํ•ด์ง‘๋‹ˆ๋‹ค.

add more word to make the intent explicit

์š”์•ฝ์„ ๋” ๋งŽ์€ ๋‹จ์–ด๋กœ ํ‘œํ˜„ํ•˜์‹ญ์‹œ์˜ค.

key and legend

explain shapes, line styles, colours, borders, acronyms , etc even if you notations seems obvious

ํ‘œ๊ธฐ๋ฒ•์ด ๋ถ„๋ช…ํ•ด ๋ณด์ด๋”๋ผ๋„ ๋ชจ์–‘, ์„  ์Šคํƒ€์ผ, ์ƒ‰์ƒ, ํ…Œ๋‘๋ฆฌ, ์•ฝ์–ด ๋“ฑ์„ ์„ค๋ช…ํ•˜์‹ญ์‹œ์˜ค.

๋™๊ธฐ ์‹ค์„  ๋น„๋™๊ธฐ๋Š” ์ ์„  ๋“ฑ์œผ๋กœ ํ• ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ปฌ๋Ÿฌ๋Š” ์ƒ‰๋งน์„ ๊ณ ๋ คํ•˜๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

use shape,colour and size to complement a diagram the already make sense

์ด๋ฏธ ์˜๋ฏธ๊ฐ€ ์žˆ๋Š” ๋‹ค์ด์–ด๊ทธ๋žจ์„ ๋ณด์™„ํ•˜๊ธฐ ์œ„ํ•ด ๋ชจ์–‘, ์ƒ‰์ƒ ๋ฐ ํฌ๊ธฐ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

icon

use icons to supplement text, not replace it

์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ํ…์ŠคํŠธ๋ฅผ ๋Œ€์ฒดํ•˜์ง€ ์•Š๊ณ  ๋ณด์ถฉํ•˜์‹ญ์‹œ์˜ค.

increase the readability of software architecture diagrams, so they can stand alone

์†Œํ”„ํŠธ์›จ์–ด ์•„ํ‚คํ…์ฒ˜ ๋‹ค์ด์–ด๊ทธ๋žจ์˜ ๊ฐ€๋…์„ฑ์„ ๋†’์—ฌ ๋…๋ฆฝ์ ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์•„์ด์ฝ˜์„ ์ถ”๊ฐ€ํ•˜์—ฌ ์ดํ•ด๋ฅผ ๋„์šธ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

any narrative should complement the diagram rather than explain it

์–ด๋–ค ๋ณด์ถฉ ๋ฌธ์„œ๋“  ๋‹ค์ด์–ด๊ทธ๋žจ์„ ์„ค๋ช…ํ•˜๊ธฐ๋ณด๋‹ค ๋ณด์™„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

notation check list

https://modeling.com/review/ ์—ฌ๊ธฐ์„œ ํ•ด๋ณผ์ˆ˜ ์žˆ๋‹ค. ์•„๋ž˜์—์„œ ์„ค๋ช…

abstractions first, notation second

์ฒซ ๋ฒˆ์งธ๋Š” ์ถ”์ƒํ™”

๋‘ ๋ฒˆ์งธ๊ฐ€ ํ‘œ๊ธฐ๋ฒ•

ensure that your team has a ubiqutous language to describe software architecture

ํŒ€์ด ์†Œํ”„ํŠธ์›จ์–ด ์•„ํ‚คํ…์ฒ˜๋ฅผ ์„ค๋ช…ํ•˜๋Š” ์œ ๋น„์ฟผํ„ฐ์Šค ์–ธ์–ด๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.

์œ ๋น„์ฟผํ„ฐ์Šค ์ปดํ“จํŒ…์ด๋ž€ '(์‹ ์€)์–ด๋””์—๋‚˜ ๋„๋ฆฌ ์กด์žฌํ•œ๋‹ค'๋Š” ๋ผํ‹ด์–ด ubiquitarius์˜ ์˜์–ด์‹ ๋ณ€ํ˜• 'Ubiquitous'์™€ ์ปดํ“จํŒ…์ด ๊ฒฐํ•ฉ๋œ ๋‹จ์–ด๋กœ '์–ธ์ œ ์–ด๋””์„œ๋“  ์–ด๋–ค ๊ธฐ๊ธฐ๋ฅผ ํ†ตํ•ด์„œ๋„ ์ปดํ“จํŒ…ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ'์„ ์˜๋ฏธํ•œ๋‹ค.

review

General

๋„ํ‘œ์— ์ œ๋ชฉ์ด ์žˆ์Šต๋‹ˆ๊นŒ?

๋‹ค์ด์–ด๊ทธ๋žจ ์œ ํ˜•์ด ๋ฌด์—‡์ธ์ง€ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

๋‹ค์ด์–ด๊ทธ๋žจ ๋ฒ”์œ„๊ฐ€ ๋ฌด์—‡์ธ์ง€ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

๋‹ค์ด์–ด๊ทธ๋žจ์— ํ‚ค/๋ฒ”๋ก€๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ?

Elements

๋ชจ๋“  ์š”์†Œ์— ์ด๋ฆ„์ด ์žˆ์Šต๋‹ˆ๊นŒ?

๋ชจ๋“  ์š”์†Œ์˜ ์œ ํ˜•์„ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ? (์˜ˆ: ์ถ”์ƒํ™” ์ˆ˜์ค€, ์˜ˆ: ์†Œํ”„ํŠธ์›จ์–ด ์‹œ์Šคํ…œ, ์ปจํ…Œ์ด๋„ˆ ๋“ฑ)

๋ชจ๋“  ์š”์†Œ๊ฐ€ ๋ฌด์—‡์„ ํ•˜๋Š”์ง€ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

ํ•ด๋‹น๋˜๋Š” ๊ฒฝ์šฐ ๋ชจ๋“  ์š”์†Œ์™€ ๊ด€๋ จ๋œ ๊ธฐ์ˆ  ์„ ํƒ ์‚ฌํ•ญ์„ ์ดํ•ดํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ์•ฝ์–ด์™€ ์•ฝ์–ด์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ์ƒ‰์ƒ์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ๋ชจ์–‘์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ์•„์ด์ฝ˜์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ํ…Œ๋‘๋ฆฌ ์Šคํƒ€์ผ์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๊นŒ? (์˜ˆ: ์‹ค์„ , ์ ์„  ๋“ฑ)

์‚ฌ์šฉ๋œ ๋ชจ๋“  ์š”์†Œ ํฌ๊ธฐ์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ? (์˜ˆ: ์ž‘์€ ์ƒ์ž์™€ ํฐ ์ƒ์ž)

๊ด€๊ณ„

๋ชจ๋“  ํ–‰์— ํ•ด๋‹น ๊ด€๊ณ„์˜ ์˜๋„๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๋ ˆ์ด๋ธ”์ด ์žˆ์Šต๋‹ˆ๊นŒ?

ํ•ด๋‹น๋˜๋Š” ๊ฒฝ์šฐ ๋ชจ๋“  ๊ด€๊ณ„์™€ ๊ด€๋ จ๋œ ๊ธฐ์ˆ  ์„ ํƒ์„ ์ดํ•ดํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๊นŒ? (์˜ˆ: ํ”„๋กœ์„ธ์Šค ๊ฐ„ ํ†ต์‹ ์„ ์œ„ํ•œ ํ”„๋กœํ† ์ฝœ)

์‚ฌ์šฉ๋œ ๋ชจ๋“  ์•ฝ์–ด์™€ ์•ฝ์–ด์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ์ƒ‰์ƒ์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ํ™”์‚ด์ด‰์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ?

์‚ฌ์šฉ๋œ ๋ชจ๋“  ์„  ์Šคํƒ€์ผ์˜ ์˜๋ฏธ๋ฅผ ์ดํ•ดํ•ฉ๋‹ˆ๊นŒ? (์˜ˆ: ์‹ค์„ , ์ ์„  ๋“ฑ)

Last updated

Was this helpful?