Slide 1

Slide 1 text

Spring with React FOR ENTERPRISE APPLICATION Tagbangers, Inc. Spring Fest 2019

Slide 2

Slide 2 text

ࢁ㟒 େ λάόϯΨʔζೖࣾ5೥໨ɻ WebΞϓϦέʔγϣϯͷ։ൃɺϚωδϝϯτΛ୲౰ɻ JavaɺSpring͸΋ͪΖΜɺٕज़ͷ͜ͱͳΒͳΜͰ΋޷͖ɻ ͨͩͷΘ͞΋Μɻ ઃᒜ େޛ λάόϯΨʔζೖࣾ1೥໨ɻ WebΞϓϦέʔγϣϯͷϑϩϯτΤϯυ։ൃΛ୲౰ɻ

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

اۀ͕༧ࢉΛׂ͍ͯങ͏γεςϜ ͦͷγεςϜΛ࢖ͬͯϏδωεΛ·Θ͢ ੒௕͢Δۀ຿ͷத৺ͱͳΔΞϓϦέʔγϣϯ Enterprise

Slide 5

Slide 5 text

Enterprise ݱঢ়ͷϏδωεͰՁ஋Λఏڙ͠ͳ͕Β কདྷ΋Ձ஋Λग़͠ଓ͚Διϑτ΢ΣΞ Ͱͳ͚Ε͹ͳΒͳ͍

Slide 6

Slide 6 text

มԽͰ͖Δ UI มԽʹڧ͍γεςϜ Enterprise

Slide 7

Slide 7 text

ۀ຿γεςϜʹͦ͜ɺ มԽΛٻΊΔ͜ͱ͕Ͱ͖Δ ϞμϯͳUIɾγεςϜ͕ඞཁͩͱߟ͍͑ͯ·͢

Slide 8

Slide 8 text

Spring + React @tagbangers way Dev Conversation Frontend Backend Day 0 Day 1 Day 2 CI CD Ops Ops Feedback Enhancement > Share knowledge Contract

Slide 9

Slide 9 text

Day 0 Conversation Conversation UI Dev Service Dev Contract Ops Day 0 Day 1 Day 2

Slide 10

Slide 10 text

https://www.eventstorming.com/

Slide 11

Slide 11 text

σʔλ͚ͩͰ࣮ࡍͷۀ຿͕ճ͍ͬͯΔΘ͚Ͱ͸ͳ͍ ۀ຿ϓϩηε = σʔλͱɺͦΕΛԿΒ͔ͷํ๏ͰԿΒ͔ͷܗʹ͢Δ͜ͱ ϞσϧԽ͢Δ΂͖ۀ຿ϓϩηεͷ։࢝఺Λ୳Δɹ-> Domain Event ։ൃνʔϜɾϓϩμΫτνʔϜ͕ҰॹʹϓϩμΫτʹֶ͍ͭͯͿ

Slide 12

Slide 12 text

1. Կ͕ى͔ͬͨ͜?ʢ Domain Event ʣΛ୳Δ 2. ͳͥىͬͨ͜ͷ͔?Λ୳Δ 3. Domain Event Λى͜͢ʹ͸ͳʹ͔৚݅͸͋Δ͔? 4. Domain Event ͕ӨڹΛ༩͑Δ΋ͷ͸Կ͔ 5. Bounded ContextΛ୳͢

Slide 13

Slide 13 text

λάόϯΨʔζͰຖि༵ۚʹߦΘΕΔϥϯνϛʔςΟϯά ࣮ફ

Slide 14

Slide 14 text

1. ேձͰΈΜͳͰ͡ΌΜ͚Μɻ 2. ̎൪໨ʹউͪൈ͍ͨਓ͕ళΛܾΊΔ͜ͱ͕Ͱ͖Δɻ 3. উऀ͸޷͖ͳళΛબΜͰslack #meshibanͰप஌ 4. ݸʑʹ৯΂͍ͨ΋ͷΛใࠂͯ͠΋Β͏ 5. উऀ͸ใࠂΛ·ͱΊͯ஫จ͢Δ 6. ಧ͍ͨΒձࣾʹ͓ۚΛ෷ͬͯ΋Β͏ ۀ຿ϑϩʔ

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

1. Bounded Context = Deployment unit ͕Θ͔Δ 2. ۀ຿ϓϩηε͕୭ or ԿʹΑͬͯ։࢝͢Δͷ͔ɺͲͷΑ͏ͳ ෭࡞༻ͱ݁ՌΛੜΉͷ͔͕Θ͔Δ 3. Domain Event ͷ৚݅Ͱ͋Δ Invariant ͕ෳࡶʹͳΔ΄Ͳ αʔϏεͷ༏ҐੑͱͳΔ෦෼͕ݟ͑ͯ͘Δ 4. νʔϜͰڞ௨ͷϓϩμΫτࢹ఺͕࣋ͯΔ

Slide 22

Slide 22 text

Modeling ϞσϦϯά = ந৅Խ͢Δ࡞ۀ ίϯςΩετʹΑͬͯந৅౓͕ҟͳΔ ڞ༗͢Δʮ໊લʯʢϞσϧɾଐੑʣΛܾΊ͍ͯ͘

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

UI Development Service Development Shared Mental Model ͜͜Ͱɺ࡞Ζ͏ͱ͍ͯ͠Δ΋ͷΛڞ༗͕Ͱ͖ͨͷͰ ͔͜͜ΒผΕͯ։ൃΛ࢝Ί·͢

Slide 25

Slide 25 text

Day 1 UI Dev Conversation UI Dev Service Dev Contract Ops Day 0 Day 1 Day 2

Slide 26

Slide 26 text

Ұ؏ੑͷ͋ΔUI มߋʹڧ͍UI Problems UI Dev

Slide 27

Slide 27 text

Ұ؏ੑΛอͭ ཁૉͷදݱ͕৔ॴʹΑͬͯҧ͏ Ϛʔδϯ͕งғؾͰܾ·Δ ௥Ճ͚ͩ͞Ε͍ͯ͘ελΠϧ৘ใͨͪ

Slide 28

Slide 28 text

https://css-tricks.com/oh-no-stylesheet-grows-grows-grows-append-stylesheet-problem/

Slide 29

Slide 29 text

CSS-in-JS is the rescue!

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Automatic critical CSS No class name bugs Easier deletion of CSS Simple dynamic styling Painless maintenance Automatic vendor prefix

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

global theme props Simple dynamic styling

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

Ұ؏ੑͷ͋ΔUIɹ มߋʹڧ͍UI Problems UI Dev

Slide 36

Slide 36 text

Component Development

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Component Χλϩά Component ͷ༷ʑͳঢ়ଶΛ֬ೝͰ͖Δ༷ʹͳΔ Component ୯ಠͰͷ։ൃʹϑΥʔΧε͢Δ σʔλͱৼΔ෣͍Λ༩͑ΒΕͨ௨Γʹ΍Δ͚ͩ 1ͭͷ͜ͱΛ͏·͘΍ΔϠπʹ͢Δ

Slide 40

Slide 40 text

Component ͷ෼ׂ a.k.a Atomic Design

Slide 41

Slide 41 text

Component ͷ෼ׂ a.k.a Atomic Design Foundations Elements Blocks Layouts Screens

Slide 42

Slide 42 text

styled-components ͷ theme ৭΍ִؒɺϑΥϯταΠζͳͲͷҰ؏ੑΛอͭͨΊͷཁૉ Foundations

Slide 43

Slide 43 text

UIΛߏ੒͢Δجૅཁૉ ͜ΕҎ্ࡉ෼Խͯ͠΋ҙຯ͕ͳ͍΋ͷ͸ Element component ͱͯ͠࡞Δ Elements

Slide 44

Slide 44 text

BUTTON ICON

Slide 45

Slide 45 text

Elements, Blocks͔Β੒Δෳ߹తͳཁૉ Blocks

Slide 46

Slide 46 text

Jane Doe LOGIN Wellcome! Your name Password

Slide 47

Slide 47 text

Layouts ϨΠΞ΢τͷύλʔϯ

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

ϖʔδ Screens

Slide 50

Slide 50 text

Jane Doe Awesome app John Smith

Slide 51

Slide 51 text

Ұ؏ੑͷ͋ΔUIɹ มߋʹڧ͍UIɹ ɹ Problems UI Dev

Slide 52

Slide 52 text

EventStorming Ͱൃݟͨ͠ Domain Event , workflowΛ࣮૷͢Δ Views States View Usecase ։࢝ ͡ΌΜ͚Μத ࣗ෼ͷखΛબ୒ ࣗ෼ͷखΛܾΊΔ ࣗ෼ͷखΛAPIʹ ొ࿥ͯ͠΋Β͏ States ͡ΌΜ͚Μऴྃ

Slide 53

Slide 53 text

Your name Preparing for reception ROCK PAPER SCISSORS START

Slide 54

Slide 54 text

Your name Preparing for reception ROCK PAPER SCISSORS START

Slide 55

Slide 55 text

Your name Preparing for reception ROCK PAPER SCISSORS START Views ։࢝ Store

Slide 56

Slide 56 text

Your name Preparing for reception ROCK PAPER SCISSORS ͡ΌΜ͚Μத START Views ։࢝ Store

Slide 57

Slide 57 text

Your name Accepting ROCK PAPER SCISSORS ͡ΌΜ͚Μத START Views ։࢝ Store

Slide 58

Slide 58 text

Your name Accepting ROCK PAPER SCISSORS ͡ΌΜ͚Μத START Views ։࢝ Store

Slide 59

Slide 59 text

Your name ROCK PAPER SCISSORS START Views ։࢝ Store API ։࠵ঢ়گΛมߋ Preparing for reception มߋத

Slide 60

Slide 60 text

Your name Accepting ROCK PAPER SCISSORS ͡ΌΜ͚Μத START Views Store API Response Success

Slide 61

Slide 61 text

Your name Accepting ROCK PAPER SCISSORS START

Slide 62

Slide 62 text

Your name Accepting ROCK PAPER SCISSORS View ࣗ෼ͷखΛબ୒ START move: SCISSOR Store

Slide 63

Slide 63 text

Your name Accepting ROCK PAPER SCISSORS View ࣗ෼ͷखΛબ୒ START move: SCISSOR Store

Slide 64

Slide 64 text

Your name Accepting ROCK PAPER SCISSORS View ࣗ෼ͷखΛબ୒ START move: SCISSOR Store

Slide 65

Slide 65 text

Your name Accepting ROCK PAPER SCISSORS View ࣗ෼ͷखΛબ୒ START Store API ࣗ෼ͷखΛొ࿥ move: SCISSOR

Slide 66

Slide 66 text

Your name Accepting ROCK PAPER SCISSORS View ࣗ෼ͷखΛબ୒ START ొ࿥։࢝ Store API ࣗ෼ͷखΛొ࿥ ొ࿥த move: SCISSOR

Slide 67

Slide 67 text

Your name Accepting ROCK PAPER SCISSORS View ࣗ෼ͷखΛબ୒ START Store API ࣗ෼ͷखΛొ࿥ API Response move: SCISSOR

Slide 68

Slide 68 text

Your name Wait for Result ROCK PAPER SCISSORS View START Store API API Response ొ࿥੒ޭ ొ࿥ऴྃ

Slide 69

Slide 69 text

trigger workflow event Action Repository interaction Component [presentational] Component [Container] Store Reducer Middleware Action Use case Execute Result State props Entity Result uses uses API

Slide 70

Slide 70 text

Day 1 Service Dev Conversation UI Dev Service Dev Contract Ops Day 0 Day 1 Day 2

Slide 71

Slide 71 text

αʔϏε / Ϟδϡʔϧͷ෼ׂ Spring ͷ Ecosystem ͳʹΛ͔ͭ͏ʁ มԽ͢ΔͨΊͷ४උ Problems ServiceDev

Slide 72

Slide 72 text

αʔϏε / Ϟδϡʔϧͷ෼ׂ୯ҐΛߟ͑Δ Conversation UI Dev Service Dev Contract Ops Day 0 Day 1 Day 2

Slide 73

Slide 73 text

workflow Service Development

Slide 74

Slide 74 text

workflow Service Development

Slide 75

Slide 75 text

workflow Service Development REST REST Messaging

Slide 76

Slide 76 text

Spring ͷͳʹΛ͔ͭ͏ͷ͔ʁ

Slide 77

Slide 77 text

workflow Service Development Invariant ʢԫ৭ʣ͕ͳ͍ ࢀর͸͞ΕΔ webhook ʹΑΔ POST → Spring Data RESTʂ

Slide 78

Slide 78 text

workflow Service Development Invariant ʢԫ৭ʣ͕ଟ͍
 → ෳࡶͳཁ݅
 → ࡞ΓࠐΈ͕ඞཁ Messaging → Spring MVC
 → Spring Cloud Stream Messaging Invariant!

Slide 79

Slide 79 text

มԽ͢ΔͨΊͷ४උ

Slide 80

Slide 80 text

workflow Service Development Unit Test ͔Β࢝ΊΔ → TDD

Slide 81

Slide 81 text

workflow Service Development

Slide 82

Slide 82 text

workflow Service Development

Slide 83

Slide 83 text

αʔϏε / Ϟδϡʔϧͷ෼ׂ 
 → Bounded Context Ͱ෼͚Δ Spring ͷ Ecosystem ͳʹΛ͔ͭ͏ʁ
 → ෇ᝦ΍໼ҹ͔Βಛ௃ΛΈ͚ͭΔ มԽ͢ΔͨΊͷ४උ
 → TDD ͷཁૉ͕͢Ͱʹ͋Δ ServiceDev

Slide 84

Slide 84 text

Day 1 Contract - Consumer Driven Contract Share Knowledge UI Dev Service Dev Contract Ops

Slide 85

Slide 85 text

workflow Integration Test ͷ՝୊ ࿈ܞ͢ΔαʔϏε͕ͨ͘͞Μ͋Δͱɾɾɾ ͢΂ͯͷ؀ڥΛ४උ͢Δͷ͸େม ४උͰ͖ͯ΋ςετ͕஗͍ ଎͘ɺ؆୯ʹ͢ΔͨΊʹϞοΫʹ͍ͨ͠ɾɾɾ ϞοΫ͸৴༻Ͱ͖ͳ͍

Slide 86

Slide 86 text

Consumer Broker Service Contract Unit Test Contract = Pact file

Slide 87

Slide 87 text

Consumer Broker Service Contract Unit Test Contract

Slide 88

Slide 88 text

Consumer Broker Service Contract Unit Test Contract Unit Test

Slide 89

Slide 89 text

Consumer Broker Service Contract Unit Test Contract Unit Test Green

Slide 90

Slide 90 text

Consumer Broker Service Contract Unit Test Unit Test Green ✅ Verified ! Contract

Slide 91

Slide 91 text

Consumer Broker Service Contract Unit Test Contract Unit Test Green ✅ Verified ! API Stub Contract

Slide 92

Slide 92 text

DEMO

Slide 93

Slide 93 text

Consumer Broker Service Contract Unit Test Contract Unit Test Green ✅ Verified ! API Stub Contract

Slide 94

Slide 94 text

มԽʹڧ͍γεςϜ΁ͷΞϓϩʔν • νʔϜͰShared mental modelΛҭͯΔ • ڥքΛཧղͯ͠Ϟδϡʔϧ΍αʔϏεΛ෼͚ͯΔ͜ͱͰ طଘαʔϏεʹӨڹ༩͑ͣʹ։ൃ • Contract ͕͋Δ͜ͱͰɺطଘΞϓϦέʔγϣϯΛյͣ͞ ʹ։ൃ

Slide 95

Slide 95 text

͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠