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
Goでのチーム開発に途中参画した私が納得して実装を進めるためにやったこと ~ 命名編 ~
Search
m_t_tion1
June 09, 2024
Programming
0
350
Goでのチーム開発に途中参画した私が納得して実装を進めるためにやったこと ~ 命名編 ~
オンボーディング時に抱いた疑問から、Goの思想を再度振り返った上でチーム内で改めてコーディングルールのすり合わせを行った結果の一例の紹介です。
m_t_tion1
June 09, 2024
Tweet
Share
More Decks by m_t_tion1
See All by m_t_tion1
初めてOSSを作って公開した話
kaorumuta
0
550
Other Decks in Programming
See All in Programming
Refactor your code - refactor yourself
xosofox
1
260
Criando Commits Incríveis no Git
marcelgsantos
2
170
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
Jakarta EE meets AI
ivargrimstad
0
230
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
690
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
220
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
210
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
45
7k
Faster Mobile Websites
deanohume
305
30k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Docker and Python
trallard
42
3.1k
Why Our Code Smells
bkeepers
PRO
335
57k
Code Reviewing Like a Champion
maltzj
520
39k
What's in a price? How to price your products and services
michaelherold
243
12k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Navigating Team Friction
lara
183
15k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Transcript
GoͰͷνʔϜ։ൃʹ్தࢀըͨ͠ࢲ͕ ೲಘ࣮ͯ͠ΛਐΊΔͨΊʹͬͨ͜ͱ ~ ໋໊ฤ ~ 2024/06/07@(Unofficial) Go Conference 2024 Pre
Party
ࣗݾհ 2 Kaoru Muta ໂా ܆ (ϝϯτε) ੜ·ΕҭͪେࡕͰࠓେࡕʹ͍·͢ 20242݄ʹגࣜձࣾBuySell Technologies
join. ങऔج൫/๚ങऔʹಛԽͨ͠αʔϏεͷ৽ن։ൃʹैࣄ ങऔɾࠪఆ ങऔछผʹԠͨ͡࠷దͳγεςϜߏங Visit -๚ങऔ- Store -ళฮങऔ- ങऔ ϦϢʔεϓϥοτϑΥʔϜCosmos ࣗࣾ։ൃͷϦϢʔεಛԽۀجװγεςϜͰ͋ΓαʔϏε܈ͷू߹ମ @m_t_tion1
ຊൃදͷཁͱϞνϕʔγϣϯ 3 ʮڷ (=Go)ʹೖΒڷʹै͑ʯΛνʔϜͰୡ͢ΔͨΊʹ ίʔσΟϯάʹؔ͢Δҙࢥ౷ҰΛνʔϜͰߦͬͨΒɺ ίʔυʹҰ؏ੑ͕ग़ͨ & ϨϏϡʔίετͱΈϙΠϯτ͕গͳ͘ ͳͬͨ ཁ
Ϟνϕ ҎԼͷΛօʹฉ͍ͯΧδϡΞϧʹσΟεΧογϣϯ͍ͨ͠ • ൃදͰऔΓ্͛Δࣄʹࣅͨૺ۰ͨ͜͠ͱ͕͋Δ͔ ◦ ૺ۰ͨ͠߹ɺͲ͏ରॲ͔ͨ͠ ◦ ͠ͳ͔ͬͨ߹ɺެࣜͷϧʔϧʹै͏ͷΈͰ ेͩͬͨͷ͔
ΦϯϘʔσΟϯά࣌ͷܦݧ 4 • ࠓ·ͰJavaϝΠϯͰॻ͍͍ͯͨΤϯδχΞ • GoͰ࡞͍ͬͯΔ0 → 1ͷ৽ن։ൃͷ్தͰJOIN • طଘίʔυΛ֬ೝ͠ΩϟονΞοϓ
ঢ়گ ײ • Goදݱੑ͕͘ɺॻ͖ํͷΒ͖ͭগͳ͍ͣ (গͳ͘ͱJavaΑΓ) ͔͠͠ɺҎԼͷͰΒ͖͕ͭɾɾ ◦ ม໊ͷলུͷํ ◦ ϙΠϯλͷ͍ॴ...etc ίʔυϨϏϡʔͷίετ૿Ճ, ॻ͖ํʹ໎͍͕ੜ͡ΔՄೳੑ
ΦϯϘʔσΟϯά࣌ͷܦݧ 5 • ࠓ·ͰJavaϝΠϯͰॻ͍͍ͯͨΤϯδχΞ • GoͰ࡞͍ͬͯΔ0 → 1ͷ৽ن։ൃͷ్தͰJOIN • طଘίʔυΛ֬ೝ͠ΩϟονΞοϓ
ঢ়گ ײ • Goදݱੑ͕͘ɺॻ͖ํͷΒ͖ͭগͳ͍ͣ (গͳ͘ͱJavaΑΓ) ͔͠͠ɺҎԼͷͰΒ͖͕ͭɾɾ ◦ ม໊ͷলུͷํ ◦ ϙΠϯλͷ͍ॴ...etc ίʔυϨϏϡʔͷίετ૿Ճ, ॻ͖ํʹ໎͍͕ੜ͡ΔՄೳੑ ຊൃදͷτϐοΫ
6 Έͳ͞Μಉ͡Α͏ͳײΛ ࣋ͬͨ͜ͱ͋Γ·͔͢ʁ
7 ࣌ͷࢲͷ߹
8 GoͷࢥΛΔͨΊʹ Ұ୴ެࣜdocͱؔ࿈ࢿྉΛړΖ͏
9 Effective GoͱGo styleguideͰͷߟ͑ํ ~ʮաෆͳ͍ʯ໋໊ʹ͍ͭͯ ~
Effective Go - #names • ͳ໋໊ආ͚Δ͖ 10 ref: https://go.dev/doc/effective_go#names Good
:+1: Bad :-1:
Go styleguide - #variable-names • ʮաෆͳ͍ʯ (= Clarity / Concision)
໋໊Λ͖͢ ◦ ม͕ࢀর͞ΕΔൣғ (= Scope)ʹԠͯ͡ҟͳΔ ◦ লུ͍ͯ͠είʔϓͰมͷׂ͕ࣗ໌ͳΒOK ◦ লུͨ͠มΛ͍είʔϓͰ͍ճ͢ͱՄಡੑ͕མͪΔͨΊNG 11 *ߦݫ֨ͳͷͰͳ͘ɺGo styleguideهࡌͷࢀߟͰհ͞Ε͍ͯΔࣈ ref: https://google.github.io/styleguide/go/decisions#variable-names ͍είʔϓͷྫ (*1~7ߦ) ͍είʔϓͷྫ (*25ߦ~)
ݸਓͷݟղ • େલఏͱͯ͠GoެࣜͰఏএ͍ͯ͠Δࢥʹै͏ • ݸਓ͓ΑͼνʔϜͰʮաෆͳ໋໊͍ʯͱΛࡲΓ߹Θͤͨํ͕ ࣮ऀɾϨϏϡϫʔͱʹͤʹͳΕΔͷͰʁ ◦ ͍είʔϓ ▪ Ұ࣌తͳม
▪ ؔͷ໊લฦΓ͔ΒΒ͏͕ࣗ໌ͳ߹ ◦ ͍είʔϓ ▪ ೝෛՙ্͕͕Γͦ͏ͳ߹লུ͠ͳ͍ ▪ (ͦͦ͗͢Δείʔϓϝιουͱͯ͠ͷׂΛ ݕ౼͢Δ߹͋Δ) 12
13 νʔϜͰࡲΓ߹ΘͤΔ
νʔϜͰͷ߹ҙܗ • ฐνʔϜͰͷʮաෆͳ͍ʯͬͯʁ ◦ جຊলུ͠ͳ͍ํͰɺܕείʔϓ͔Βࣗ໌ͩͱஅͨ͠Βলུ͢Δ ◦ Defined Type͏߹มͷׂ͕ࣗ໌Ͱ͋ΔͨΊলུͯ͠Α͍ (ল໊ུͨ͠લҰ؏ͯ͠͏͜ͱ) ▪
ex. salesContractID → scID bailmentReceiptID → brID ◦ ҆ͱͯ͠লུ࠷େ2୯ޠ·Ͱ ex. salesContractDocumentDetail → scdd ͱ͔ආ͚͍ͨ 14
ӡ༻ޙͷνʔϜ֎͔ΒͷϑΟʔυόοΫ 15 • νʔϜͰվΊͯGoͷࢥΛ৮ΕֶͯͿ͜ͱ͕Ͱ͖ͨ • ίʔυʹҰ؏ੑ͕ग़࣮ͯΛ͢Δ্Ͱ໎͍͕ͳ͘ͳͬͨ • (͜͜ݸਓͷײͰ͕͢) ίʔυϨϏϡʔͰGoͷࢥʹؔ࿈ ͢Δ໋໊ʹؔͯ͠ࢦఠ͢Δ͜ͱݮͬͨ
Good More • ৽نࢀೖऀ͕͖ͨ࣌ʹಉ༷ͷ͕ٞੜ·ΕΔՄೳੑ͕͋Δ ͦͷͨΊఆظతʹݟ͢͜ͱ͕ඞཁ͔ ◦ ຖม͑Δͷӡ༻ίετ͕ߴͦ͏ ◦ Goͷࢥʹै͏ͷม͑ͳ͍͍ͯ͘ ◦ ʮաෆͳ͍ʯΛೝෛՙɾՄಡੑͷ؍Ͱ ఆظతʹ͢ͷΑͦ͞͏
ຊൃදͷཁͱϞνϕʔγϣϯ 16 ʮڷ (=Go)ʹೖΒڷʹै͑ʯΛνʔϜͰୡ͢ΔͨΊʹ ίʔσΟϯάʹؔ͢Δҙࢥ౷ҰΛνʔϜͰߦͬͨΒɺ ίʔυʹҰ؏ੑ͕ग़ͨ & ϨϏϡʔίετͱΈϙΠϯτ͕গͳ͘ ͳͬͨ ཁ
Ϟνϕ ҎԼͷΛօʹฉ͍ͯΧδϡΞϧʹσΟεΧογϣϯ͍ͨ͠ • ൃදͰऔΓ্͛Δࣄʹࣅͨૺ۰ͨ͜͠ͱ͕͋Δ͔ ◦ ૺ۰ͨ͠߹ɺͲ͏ରॲ͔ͨ͠ ◦ ͠ͳ͔ͬͨ߹ɺެࣜͷϧʔϧʹै͏ͷΈͰ ेͩͬͨͷ͔
17 Έͳ͞ΜͲ͏ͯ͠·͔͢ʁ
Thank You!