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
Tomoki Ota
July 25, 2024
Programming
0
320
【Go言語】オプション設定のベストプラクティス
Go言語のオプション設定方法について、解説しています。
【Qiita】
【Go言語】オプション設定のベストプラクティス
Tomoki Ota
July 25, 2024
Tweet
Share
More Decks by Tomoki Ota
See All by Tomoki Ota
アーキテクチャの価値
tomo1227
0
88
アーキテクチャとビジネスロジック
tomo1227
0
86
【Go言語】テスト
tomo1227
0
50
【Go言語】クロージャ
tomo1227
0
250
【Go言語】イテレータ
tomo1227
0
67
【Go言語】エラーハンドリング
tomo1227
0
56
AIに淘汰されないようにするには?
tomo1227
0
57
【Go言語】range
tomo1227
0
60
【Go言語】break
tomo1227
0
59
Other Decks in Programming
See All in Programming
詳解!defer panic recover のしくみ / Understanding defer, panic, and recover
convto
0
210
CloudflareのChat Agent Starter Kitで簡単!AIチャットボット構築
syumai
2
360
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
310
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
350
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
2
220
ソフトウェアテスト徹底指南書の紹介
goyoki
1
130
Kiroで始めるAI-DLC
kaonash
2
520
UbieのAIパートナーを支えるコンテキストエンジニアリング実践
syucream
2
800
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
15
6.7k
機能追加とリーダー業務の類似性
rinchoku
0
460
速いWebフレームワークを作る
yusukebe
4
1.6k
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
280
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.8k
What's in a price? How to price your products and services
michaelherold
246
12k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Visualization
eitanlees
147
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Become a Pro
speakerdeck
PRO
29
5.5k
The Pragmatic Product Professional
lauravandoore
36
6.8k
Transcript
Tomoki Ota ʲGoݴޠʳΦϓγϣϯઃఆͷϕετϓϥΫςΟε
HTTPαʔόͷ࡞ 2
HTTPαʔόͷ࡞ 3
GinͷNew() 4
ᶃγϯϓϧͳΦϓγϣϯઃఆ ᶄCon f igߏମ ᶅBuilderύλʔϯ ᶆؔΦϓγϣϯύλʔϯ ᶇDysfunctional Options Pattern ᶈ݁
ΞδΣϯμ
γϯϓϧͳΦϓγϣϯઃఆํ๏
7 γϯϓϧͳઃఆํ๏
γϯϓϧͳઃఆํ๏ debugͷઃఆΛՃ͢Δ
HTTPαʔόͷ࡞ 9 ΫϥΠΞϯτଆͰҾ͕Γͳͯ͘յΕΔ
γϯϓϧͳઃఆํ๏
Con f igߏମ
Con f igߏମ
Con f igߏମ 13
Con f igߏମ 14
Con f igߏମ 15
ࢦఆ͠ͳ͔ͬͨύϥϝʔλʹθϩ͕ೖΔ(ҙ ਤతʹ0Λೖͨ͠ͷ͔ɺະೖྗͳͷ͔ͷҧ͍͕ ͔Βͳ͍) Con f igߏମͷσϝϦοτ
ࢦఆ͠ͳ͔ͬͨύϥϝʔλʹθϩ͕ೖΔ(ҙ ਤతʹ0Λೖͨ͠ͷ͔ɺະೖྗͳͷ͔ͷҧ͍͕ ͔Βͳ͍) Con f igߏମͷσϝϦοτ ϙΠϯλΛ͏
Con f igߏମͷσϝϦοτ ϙΠϯλΛ͏
Con f igߏମͷσϝϦοτ σϑΥϧτΛ͏߹ۭΛ͢ඞཁ͕͋Δ
Builderύλʔϯ
Builderύλʔϯͱʁ GoFͷσβΠϯύλʔϯͷ̍ͭ ॊೈੑͷߴ͍ղܾࡦΛఏڙ͠ɺՄಡੑΛߴΊΔ
Builderύλʔϯ 22
Builderύλʔϯ 23
Builderύλʔϯ 24
Builderύλʔϯ GOʹJavaͷ@BuilderΑ͏ͳຐ๏ͳ͍ GoFͷσβΠϯύλʔϯͷ̍ͭͰ͋ΔBuilderύλʔϯ Λ༻͍Δ͜ͱͰɺॊೈੑͷߴ͍ղܾࡦΛఏڙ͞ΕΔɻ Builderύλʔϯͷॻ͖ํෳ͋Δɻ
Builderύλʔϯ 26
Builderύλʔϯ
BuilderύλʔϯͷσϝϦοτ Con f igߏମಉ༷ɺσϑΥϧτͷઃఆΛ༻͍ͨ͠߹ ۭͷߏମΛ͢ඞཁ͕͋Γɺݟӫ͕͑ѱ͍
ؔΦϓγϣϯύλʔϯ
Functional Optional Pattern ؔΦϓγϣϯύλʔϯՄมݸҾʹґଘ ͢Δ ؔΦϓγϣϯύλʔϯͱʁ
ؔΦϓγϣϯύλʔϯͱʁ
ؔΦϓγϣϯύλʔϯͱʁ
ؔΦϓγϣϯύλʔϯͱʁ σϑΥϧτΛઃఆ͍ͨ͠߹ઃఆ͢Δඞཁ͕ͳ͍
Dysfunctional Options Pattern
ؔΦϓγϣϯύλʔϯத͕ؒଟ͘ɺෳࡶͰ ͋Δͱ͍͏͜ͱΛࢹͨ͠ύλʔϯ Dysfunctional Options Patternͱʁ
Dysfunctional Options Pattern
BulderύλʔϯͷҰͭ Dysfunctional Options Patternͱʁ
Dysfunctional Options Patternͱʁ ނʹɺσϑΥϧτΛ༻͍ͨ͠߹ɺۭͷߏମΛ͢ඞཁ͕͋Γ·͢ɻ ނʹɺσϑΥϧτΛ༻͍ͨ͠߹ɺۭͷߏମΛ͞ͳ͚ΕͳΒͳ͍
݁
GoͰҰ൪׳༻తͰ·ΕΔͷɺؔΦϓγϣϯύλʔϯ Builderύλʔϯ࣮͍͕͢͠ɺσϑΥϧτΛઃఆ͢Δ ͱ͖ʹɺJavaͱҧͬͯบ͕͋Δ ݁
GoͰҰ൪׳༻తͰ·ΕΔͷɺؔΦϓγϣϯύλʔϯɻ Builderύλʔϯ࣮͍͚͢͠ͲɺJavaͱҧ͍ɺগ͠บ͕͋Γ· ͢ɻ ݁