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
Scaling GitHub
holman
458
140k
Six Lessons from altMBA
skipperchong
27
3.5k
Being A Developer After 40
akosma
87
590k
Statistics for Hackers
jakevdp
796
220k
Ruby is Unlike a Banana
tanoku
97
11k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Code Review Best Practice
trishagee
64
17k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
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 ੵۃ࠾༻த