Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Goでのチーム開発に途中参画した私が納得して実装を進めるためにやったこと ~ 命名編 ~
Search
m_t_tion1
June 09, 2024
Programming
660
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Goでのチーム開発に途中参画した私が納得して実装を進めるためにやったこと ~ 命名編 ~
オンボーディング時に抱いた疑問から、Goの思想を再度振り返った上でチーム内で改めてコーディングルールのすり合わせを行った結果の一例の紹介です。
m_t_tion1
June 09, 2024
More Decks by m_t_tion1
See All by m_t_tion1
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
1.8k
初めてOSSを作って公開した話
kaorumuta
0
750
Other Decks in Programming
See All in Programming
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
430
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
100
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
130
The Rails Doctrine Decade
koic
2
430
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
130
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.2k
Workers Cache を知る
syumai
0
320
setup-vp GitLab対応の裏側
naokihaba
0
140
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
4.5k
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
30
13k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
440
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
580
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Test your architecture with Archunit
thirion
2
2.4k
A Modern Web Designer's Workflow
chriscoyier
699
190k
GitHub's CSS Performance
jonrohan
1033
470k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
HDC tutorial
michielstock
2
930
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
450
Skip the Path - Find Your Career Trail
mkilby
1
240
The Mindset for Success: Future Career Progression
greggifford
PRO
0
520
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
250
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
720
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
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!