Slide 1

Slide 1 text

@simonbrown ೔ຊޠ༁ @hiranabe ιϑτ΢ΣΞͷ ΞʔΩςΫνϟΛՄࢹԽ͢Δ C4 model Visualising software architecture with the C4 model

Slide 2

Slide 2 text

Simon Brown ιϑτ΢ΣΞΞʔΩςΫνϟΛઐ໳ͱ͢Δಠཱίϯαϧλϯτ + C4 model ͱ Structurizr ͷ࡞ऀ

Slide 3

Slide 3 text

UML ࢖ͬͯ·͔͢?

Slide 4

Slide 4 text

ࢲͷܦݧͰ͸ɺָ؍తʹݟͯ ࢖͍ͬͯΔͷ͸10ਓʹ1ਓ

Slide 5

Slide 5 text

#2 “νʔϜϝϯόͷશһ͕෼͔Δ༁Ͱ͸ͳ͍” #3 “ࢲҎ֎ͷνʔϜϝϯό͸୭΋஌Βͳ͍” #36 “͓͡͞ΜͩͱࢥΘΕΔ” #37 “ྲྀߦ஗ΕͩͱࢥΘΕΔ” #66 “πʔϧ͕μϝ” #80 “ৄࡉ͗͢Δ” #81 “౒ྗ͕࣌ؒͷϜμ” #92 “ΞδϟΠϧͰ͸ෆཁ” #97 “Ձ஋͸ձ࿩ͷதʹʂ” UMLΛආ͚Δ97ͷํ๏

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

7

Slide 17

Slide 17 text

7

Slide 18

Slide 18 text

7

Slide 19

Slide 19 text

7

Slide 20

Slide 20 text

7

Slide 21

Slide 21 text

7

Slide 22

Slide 22 text

6

Slide 23

Slide 23 text

“Just use a whiteboard!”

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

ιϑτ΢ΣΞσϕϩύʔ͕ݐஙͷΞʔΩςΫνϟਤΛ࡞ͬͨΒ… ݰ͔ؔΒͷ࿓Լ ֊ஈ Ωονϯ ϦϏϯά ৸ࣨ1 ৸ࣨ3 ৸ࣨ2 ֊ஈ τΠϨ τΠϨ ্ਫ Լਫ ϐʔΫిྗ ௨ৗిྗ

Slide 27

Slide 27 text

ΤϯδχΞ͕, (ΞʔςΟετͰ͸ͳ͘)

Slide 28

Slide 28 text

νʔϜͰಉ͡ํ޲ʹ ૉૣ͘ಈͨ͘Ίʹ͸ɺ Α͍ίϛϡχέʔγϣϯ ͕ඞཁɻ

Slide 29

Slide 29 text

ਤͱจॻʹ͸͞·͟·ͳಡΈख͕͍ͯɺ ͦΕͧΕผʑͷؔ৺Λ͍࣋ͬͯΔ (ΞʔΩςΫτɺσϕϩύʔɺӡ༻αϙʔτɺςελʔ, ϓϩμΫτΦʔφʔɺϓϩδΣΫτϚωδϟɺεΫϥϜϚελʔ, Ϣʔβ, Ϛωδϝϯτ, Ϗδωεεϙϯαʔ, જࡏސ٬, જࡏ౤ࢿऀ, …)

Slide 30

Slide 30 text

ιϑτ΢ΣΞͷΞʔΩςΫνϟਤΛ ඳ͘ͱ͖͸ɺ ιϑτ΢ΣΞσϕϩύʔͱͯ͠ඳ͘ɻ

Slide 31

Slide 31 text

ڞ௨ͷந৅(abstraction)ͷηοτ ͷํ͕ɺ ڞ௨ͷϊʔςʔγϣϯΑΓ΋ॏཁ

Slide 32

Slide 32 text

software system ͸1ͭҎ্ͷ container Λ࣋ͪ, ͦΕΒ͸1ͭҎ্ͷ component Λ࣋ͪ, ͦΕΒ͕͞Βʹɺ1ͭҎ্ͷ code ཁૉ Λ࣋ͭ. Code Code Code Component Component Component Container (e.g. client-side web app, server-side web app, console application, mobile app, microservice, database schema, file system, etc) Container (e.g. client-side web app, server-side web app, console applic mobile app, microservice, database schema, file system, e Container client-side web app, server-side web app, console application, obile app, microservice, database schema, file system, etc) Software System

Slide 33

Slide 33 text

C4 c4model.com

Slide 34

Slide 34 text

4. Code (e.g. classes) Component implementation details. 1. System Context The system plus users and system dependencies. 2. Containers The overall shape of the architecture and technology choices. 3. Components Logical components and their interactions within a container. Overview first Zoom & filter Details on demand

Slide 35

Slide 35 text

μΠΞάϥϜ͸஍ਤͰ͋Δ େ͖ͯ͘ෳࡶͳίʔυϕʔεΛιϑτ΢ΣΞσϕϩύʔ͕୳ࡧ͢ΔͷΛॿ͚Δ஍ਤ

Slide 36

Slide 36 text

Zoom in Zoom in Level 1 Context Level 2 Containers Level 3 Components Level 4 Code Zoom in

Slide 37

Slide 37 text

Example (Internet Banking System)

Slide 38

Slide 38 text

Level 1 System Context diagram

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Level 2 Container diagram

Slide 44

Slide 44 text

The container diagram shows the containers that reside inside the software system boundary

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

Level 3 Component diagram

Slide 52

Slide 52 text

The component diagram shows the components that reside inside an individual container

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

Level 4 Class diagram

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

ϊʔςʔγϣϯ

Slide 60

Slide 60 text

μΠΞάϥϜ໊ ਤͷλΠτϧ͸୹ͯ͘ҙຯͷ͋Δ໊લͰɺਤͷछྨ΋ؚΊΔɻ ॱং͕ॏཁͰ͋Ε͹ਤ൪߸ΛৼΔɻྫ͑͹ɺ Financial Risk Systemͷ System Context ਤ [System Context] Financial Risk System

Slide 61

Slide 61 text

ϨΠΞ΢τ ෇ᝦࢴͱΠϯσοΫεΧʔυ(CRCΧʔυ)͸ɺ खॻ͖ͷശͷ୅ΘΓͱͯ͠͏·͘ػೳ͢Δɻ (ಛʹϗϫΠτϘʔυ͕ͳ͍৔߹)

Slide 62

Slide 62 text

ݟͨ໨ͷҰ؏ੑ શਤʹཁૉͷϊʔςʔγϣϯͱ഑ஔʹ Ұ؏ੑΛ࣋ͨͤΔΑ͏ʹ౒ྗ͢Δɻ

Slide 63

Slide 63 text

ུޠ ུޠΛ࢖͏ͱ͖͸৻ॏʹɻ ࣗ෼͕ଐ͍ͯ͠ΔϏδωε/໰୊ྖҬʹ ؔ࿈͢Δ΋ͷ͸ͳ͓͞Βɻ

Slide 64

Slide 64 text

ཁૉ γϯϓϧͳശ͔ΒελʔτͤΑɻ ໊લͱλΠϓɺٕज़(΋͠ద౰ͳΒ)ɺઆ໌ͱ໾ׂɻ

Slide 65

Slide 65 text

techtribes.je [Software System] techtribes.je ͸Channel ౡͷJersey/ Guernseyͷٕज़ɺσδλϧɺITؔ࿈ͷ࠷ ৽৘ใΛ͍࣋ͬͯΔ Anonymous User [Person] Web͔ΒΞΫηε͖ͯͨ͠୭Ͱ΋ Twitter Connector [Component: Spring Bean + Twitter4j] ϓϩϑΝΠϧ৘ใͱπΠʔτΛऔಘ (RESTͱStreaming APIΛ༻͍ͯ) Web Application [Container: Java + Spring MVC] Ϣʔβ͕஍Ҭͷٕज़ɺσδλϧɺITؔ࿈ͷ ਓɺछ଒ɺ಺༰ɺΠϕϯτɺ৬ۀɺetc.Λ ݟΔ͜ͱ͕Ͱ͖Δɻ

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

ઢ ย໼ҹΛ޷ΜͰ࢖͍ɺ࠷΋ॏཁͳґଘ΋͘͠͸ σʔλͷྲྀΕΛࣔ͢ɻจষͰ໌ࣔతʹ໨తͱํ޲Λදݱɻ

Slide 68

Slide 68 text

ؔ܎ੑͷҙਤΛཁ໿ Single Page Application [Container] API Application [Container] Makes an API request to Single Page Application [Container] API Application [Container] Makes API calls using Sends an API response to

Slide 69

Slide 69 text

ཁ໿Ͱ͸͋ͬͯ΋۩ମతʹɻ Single Page Application [Container] API Application [Container] Single Page Application [Container] API Application [Container] Makes API calls using Uses

Slide 70

Slide 70 text

ҙਤ͕ҟͳΕ͹ɺ ྆ํ޲ͷ໼ҹΛͦΕͧΕඳ͘ɻ Microservice A [Container] Microservice B [Container] Requests a list of customers from [JSON/HTTPS] Sends new customers to [Kafka topic]

Slide 71

Slide 71 text

࣮ࡍͷ෺ޠ͕ಡΊΔΑ͏ʹɻ Sends messages to Microservice D [Container] Microservice C [Container] Sends messages to Sends messages to Sends messages to Microservice B [Container] Microservice A [Container] Kafka [Container]

Slide 72

Slide 72 text

࣮ࡍͷ෺ޠ͕ಡΊΔΑ͏ʹɻ Sends customer update messages to [via Kafka topic X] Microservice D [Container] Microservice C [Container] Microservice B [Container] Microservice A [Container] Sends order creation messages to [via Kafka topic Y]

Slide 73

Slide 73 text

ҙਤΛ໌ࣔ͢ΔͨΊʹɺ୯ޠΛ௥Ճ Trade Data System [Software System] Financial Risk System [Software System] Trade data Trade Data System [Software System] Financial Risk System [Software System] Sends trade data to

Slide 74

Slide 74 text

ຌྫΛॻ͘ ܗɺઢछɺ৭ɺ࿮ઢɺུޠɺ౳ͷҙຯɻ … ࣗ෼ͷهड़ํ๏͕౰વͩͱࢥͬͯ΋!

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

ܗɺ৭ɺαΠζʹΑΔ૷০͸ ิॿͱͯ͠࢖͍ɺ ͦΕΒ͕ͳͯ͘΋ҙຯ͕෼͔ΔਤΛ ॻ͘͜ͱɻ

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

ΞΠίϯ͸ςΩετΛิ͏΋ͷɻ ςΩετΛஔ͖׵͑Δ΋ͷͰ͸ͳ͍ɻ

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

ͦͷਤ͚ͩͰҙຯ͕ͱΕΔΑ͏ɺ ιϑτ΢ΣΞΞʔΩςΫνϟਤͷ ಡΈ΍͢͞(readability) Λ޲্͠Α͏ɻ

Slide 82

Slide 82 text

આ໌ΑΓ΋ʮ෺ޠʯͷํ͕ ͏·͘ਤͷҙਤΛิؒͰ͖Δɻ

Slide 83

Slide 83 text

Notation, notation, notation A software architecture diagram review checklist General Elements Does the diagram have a title? Yes No Do you understand what the diagram type is? Yes No Do you understand what the diagram scope is? Yes No Does the diagram have a key/legend? Yes No Does every element have a name? Yes No Do you understand the type of every element? (i.e. the level of abstraction; e.g. software system, container, etc) Yes No Do you understand what every element does? Yes No Where applicable, do you understand the technology choices associated with every element? Yes No Do you understand the meaning of all acronyms and abbreviations used? Yes No Do you understand the meaning of all colours used? Yes No Do you understand the meaning of all shapes used? Yes No Do you understand the meaning of all border styles used? (e.g. solid, dashed, etc) Yes No Do you understand the meaning of all element sizes used? (e.g. small vs large boxes) Yes No

Slide 84

Slide 84 text

“ ” ਪ঑ πʔϧ ͸͋Γ·͔͢?

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

ɹಛʹ C4 model ͷͨΊʹઃܭ͞Εͨɺܰྔιϑτ΢ΣΞΞʔΩςΫνϟϞσϦϯάπʔϧɻ Markdown/AsciiDoc จॻͱADRsͰิ׬ɻ

Slide 87

Slide 87 text

ந৅͕ઌɻ ϊʔςʔγϣϯ͸࣍ɻ νʔϜ͕ιϑτ΢ΣΞΞʔΩςΫνϟΛهड़͢Δ ϢϏΩλεݴޠΛ͍࣋ͬͯΔ͜ͱɻ

Slide 88

Slide 88 text

Thank you! [email protected] @simonbrown
 ೔ຊޠ༁ @hiranabe