Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
202111Gocon_kaminashi_kimura
Search
kimura
November 30, 2021
1
2.1k
202111Gocon_kaminashi_kimura
kimura
November 30, 2021
Tweet
Share
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
How GitHub (no longer) Works
holman
310
140k
Statistics for Hackers
jakevdp
796
220k
The Cult of Friendly URLs
andyhume
78
6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Unsuck your backbone
ammeep
668
57k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Building an army of robots
kneath
302
43k
Transcript
ϊϯσεΫϫʔΧʔ͚ ϊʔίʔυαʔϏεͷͭΒΈɾ͏·Έ גࣜձࣾΧϛφγ ΞϓϦέʔγϣϯΤϯδχΞ ɹɹɹ ɹɹɹɹଜ Ұ
1. ΧϛφγͷαʔϏεհ a. ݱͷݱঢ় b. ݱΛม͑ΔͨΊͷΧϛφγͷΞϓϩʔν 2. ͏·Έ a. ΧϛφγGoྺ
b. ײͨ͡͏·Έ&֤ΤϯδχΞGoྺ 3. ։ൃʹͨͬͯͷͭΒΈ ຊͷΞδΣϯμ
1. ΧϛφγͷαʔϏεհ
ઃඋɾਗ਼ ཱྀ٬ɾӡ༌ ݐઃ ࢱࢪઃ ۀ εʔύʔɾখച ٬ۀ ҿ৯ళ ݱͰಇ͘3,100ສਓ͕ɺࢴத৺ͰඇޮͳΦϖϨʔγϣϯʹʑΘΕ͍ͯ·͢ɻ ϓϥΠϕʔτͰεϚʔτϑΥϯΛ͍ͬͯΔͷʹɺ৬Ͱͳ͔ͥࢴͱϖϯɺσδΧϝΛ͏ඞཁ͕͋Δͷ͕ݱঢ়Ͱ͢ɻ
ຊͷबۀਓޱͷ͕PCIT͕͑ͳ͍ڥͰಇ͍͍ͯ·͢ Χϛφγ͕ղܾ͍ͨ͜͠ͱ ຊʹ͓͚Δ࿑ಇਓޱͷׂ߹ 9 σεΫ ϫʔΧʔ ϊϯσεΫ ϫʔΧʔ ˋ ˋ 52 48 ※ ಠཱߦ๏ਓ࿑ಇࡦݚڀɾݚमػߏʮ৬ۀผबۀऀʯΑΓࣾࢉग़
ه ֬ೝ ूܭɾՄࢹԽ ޱ಄Ͱࢦಋ ͯ͢ਓྗʹΑΔۀΦϖϨʔγϣϯ
݁Ռͱͯ͠ϛε͕ଟൃ
̋×νΣοΫද ࢴͷνΣοΫϦετʢϫʔΫϑϩʔʣ ΧϛφγͰσδλϧԽ ϊʔίʔυͰݱཧΞϓϦΛ࡞Δ͜ͱ͕Ͱ͖Δ ɹۀϑϩʔΛσδλϧԽ͢Δ
݅ذ ܁Γฦ͠ LOOP IF-ELSE ଟ༷ͳσʔλܕ TYPE ɹϊʔίʔυ͚ͩͲɺᙱ͍ॴʹख͕ಧ͘
LOOP IF-ELSE TYPE ܁Γฦ̍͠ ܁Γฦ̎͠ ܁Γฦ̏͠ ϊʔυ ճ YESͷ߹ Noͷ߹
ߏͰදݱ ɹ෦ͷσʔλߏͰఆ͍ٛͯ͠Δ
2. ΧϛφγͷGoྺͱ͏·Έ
- 2017ͷϓϩμΫτ։ൃ։͔࢝Β4 - Goαʔόબఆཧ༝ - ඪ४tool܈ͷ๛͞ - ॏͳΔมߋʹڧ͍ - ܧঝ͕ଘࡏ͠ͳ͍
- Composition over inheritance (ܧঝΑΓ߹) - Πϯϑϥͷॊೈੑ - ΫϩείϯύΠϧ - ίϯςφԽͱͷ૬ੑ - ࣌Go࠾༻ࣄྫ͕গͳ͍ ɹΧϛφγͷGoྺͱ͏·Έ1
- ੩తܕ͚͕Ͱ͖Δ - 200ͷଟ֊ͷςʔϒϧ - IDEͷࣗಈิ ɹΧϛφγͷGoྺͱ͏·Έ1 table ᶃ֊ߏʢࢠؔʣΛදݱ͢ΔͨΊͷςʔϒϧ ᶄσʔλͷܕ͝ͱʹςʔϒϧ
ɹʢྫ͑ɺܕͱܕςʔϒϧఆ͕ٛҟͳΔʣ ɹɹetc...
ɹ։ൃʹ͓͚Δ͏·Έ2 (੩తܕ͚ݴޠͷதͰ) ະܦݧͷΤϯδχΞ͕शಘ͍͢͠ - ৽نೖࣾऀ্ཱ͕͙͕ͪ͢Δ - ࣾͰͷGoܦݧऀׂ߹= 3/7 Go JavaScr
ipt TypeScr ipt Python Elixir Ruby Java PHP C# C C++ VB Engineer A ◦ ◦ ◦ ◦ B ◦ ◦ ◦ C ◦ ◦ ◦ D ◦ ◦ ◦ E ◦ ◦ ◦ ◦ ◦ ◦ F ◦ ◦ ◦ G ◦ ◦ ◦ ◦ ◦ ฐࣾͷೖࣾલͷΤϯδχΞ༻ݴޠ
3.։ൃʹͨͬͯͷͭΒΈ
ɹͭΒΈ1 ίʔυߦͷ૿Ճ - ϦϨʔγϣϯͷଟ͞ - Preload Λଟ༻
ɹͭΒΈ1 ίʔυߦͷ૿Ճ - ϦϨʔγϣϯͷଟ͞ - genericsͷ༗ແ -> switchจʹཔΒ͟ΔΛಘͳ͍ - ߏͷσʔλ->
forloopͷଟ༻ - ؔ࿈ςʔϒϧͷ૿Ճ - ࢠnodesͷϦϨʔγϣϯ
ɹͭΒΈ2 RDBͰͷੑೳԼ - ؔ࿈ςʔϒϧͷ૿ՃʹΑΓɺapplication ⁶ RDBؒͷ௨৴ճͷ૿Ճ - application ⁶ RDBؒͷ௨৴͕ϘϧτωοΫʹ
gtx. Preload("Rel-A"). Preload("Rel-B"). Preload("Rel-C"). Find(s.ctx, &mainTable).Error; ORMΛͬͨίʔυ select ~~~ select ~~~ select ~~~ ࣮ΫΤϦ - ORMଆͰͷେྔͷΫΤϦൃߦ - ࠶ىॲཧͰͷDBΞΫηεॲཧΛॻ ͍ͯ͠·͍ɺେྔͷΫΤϦൃߦ
ɹͭΒΈ2 RDBͰͷੑೳԼͷରԠ Application ଆ - ΫΤϦൃߦॲཧͱ࠶ىॲཧΛ - ORM༻ -> (ςʔϒϧ݁߹Λߦ͏Α͏ͳ)
ੜΫΤϦʹมߋ → DB ΫΤϦൃߦճΛ͑Δ͜ͱ͕Ͱ͖ͨ DB ଆ - ςʔϒϧ݁߹Ͱ༻͞ΕΔ֎෦Ωʔʹର͢ΔindexͷՃ → ΫΤϦ୯ମͷੑೳͷվળ
ɹͭΒΈ3 ςετσʔλͷ༻ҙ ଟ֊ͷςʔϒϧɾϦϨʔγϣϯঢ়گԼͰͷςετσʔλ४උ - ॳJsonͰ۪ʹॻ͍ͯ͠·͕ͬͨͨΊʹɺAddReport ςετͷ1 test data ͚ͩͰ3000ߦ΄Ͳʹ
None
ɹͭΒΈ3 ςετσʔλͷ༻ҙ ଟ֊ͷςʔϒϧɾϦϨʔγϣϯঢ়گԼͰͷςετσʔλ४උ - ॳJsonͰ۪ʹॻ͍ͯ͠·͕ͬͨͨΊʹɺAddReport ςετͷ1 test data ͚ͩͰ3000ߦ΄Ͳʹ
ɹͭΒΈ3 ςετσʔλ४උͷରԠ Json -> ֎෦module (factory-go) ʹͯɺ֤ objectΛੜ͢ΔΑ͏ʹͨ͠
ɾϊʔίʔυͰ࡞Ͱ͖ΔݱཧΞϓϦʹΑΓɺݱͷDXΛՃͤ͞Α͏ ͱ͍ͯ͠Δ ɾ੩తܕ͚ͷಛੑɺෑډͷ͞ͷͰGoͷԸܙΛड͚͍ͯΔ ɾҰํͰɺଟ֊ͳσʔλߏΏ͑ͷίʔυ૿Ճɺࠓޙ૿͍͑ͯ͘Ͱ͋Ζ ͏RDBͷΞΫηεɺςετσʔλͷରԠ͕՝ײͱͯ͋͠Δ ɹ·ͱΊ
None
ΦϑΟεʹͬͯ͜ɺ૾͚ͩͰҙࢥܾఆ͢Δɻ టष͍͜ͱ͔ΒڑΛஔ͖ɺखΛൈ͘ɻ ސ٬ͱ͞ͳ͍ɻݱͷΛฉ͜͏ͱ͠ͳ͍ɻ ϢʔβʔࢹͰͳ͘ɺࣗࣾ߹Λ༏ઌ͢Δɻ Don'ts ݱʹϖΠϯΛମײ͠ʹߦ͘ϝϯόʔ ϢʔβʔͷΛฉͨ͘Ίɺ෦ॺΘͣݱ ݱυϦϒϯͳΤϐιʔυ
None
ఆྫϛʔςΟϯάɾࣄۀઓུϛʔςΟϯά શࣾɾνʔϜͰͷΦϑαΠτϛʔςΟϯά ใͷಁ໌ੑɺຊԻΛͿ͚ͭ߹͏Φʔϓϯίϛϡχέʔγϣϯ શ։ΦʔϓϯͳΤϐιʔυ ࣗͷྑ͍ͱ͜Ζɺද໘తͳ͔͠ڞ༗͠ͳ͍ɻ ϓϥΠυ͕ߴ͘ɺΞυόΠεΛ߈ܸͩͱड͚औΔɻ ٞʹͳΔͱػݏ͕ѱ͘ͳΔɻ ߹ͷ͍͍ӕΛͭ͘ɻ ཧɺͷΈͰҙࢥܾఆ͠ɺҙݟΛฉ͔ͳ͍ɻ ྑ͜͠Α͠ͰɺͿ͔ͭΔ͜ͱΛڪΕΔɻ
ຊਓ͕͍ͳ͍ॴͰݴ͏ɻ Don'ts શࣾһͰࣗࣾͷΧϧνϟʔʹ͍ͭͯҙݟΛग़͠߹͏ ΤϯδχΞνʔϜͷϛʔςΟϯάͷ༷ࢠ ਓੜνϟʔτൃද
None
ා͕ͬͯνϟϨϯδ͠ͳ͍ɻ ࣦഊͯ͠Կֶͳ͍ɻ ࣦഊΛڐ༰͢ΔจԽΛצҧ͍͍ͯ͠Δɻ ͙ͨ͢͜ΕΔɻมʹߟ͑͗͢Δɻ ϓϥΠυ͕ߴ͍ɻ ࢹ࠲ɾࢹ͕͍ɻߴΈΛࢦ͞ͳ͍ɻ Don'ts ΧϛφγͷࣄͷελΠϧɻߟ͑ൈ͍ͨΒɺ·ͣͬͯΈΔɻ β൛ϚΠϯυͳΤϐιʔυ ࠾༻ΟογϡϦετ
νʔϜͷΈͮ͘Γ Έͮ͘Γ੍ γϦʔζAࢿۚௐୡ ։ൃϓϩδΣΫτ 3
EM/ΞϓϦΤϯδχΞ/SRE ੵۃ࠾༻த