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とMicroserviceでDDDやってみました
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
hitsuji-haneta
April 20, 2020
Programming
430
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GoとMicroserviceでDDDやってみました
hitsuji-haneta
April 20, 2020
Transcript
22 slides
やってみました Go MicroService DDD で と 2020/04/20 DDD Talk Meetup
Online
高橋翔太 hitsuji-haneta LasTrust株式会社 h1tsuj1_haneta https://lastrust.io ・ブロックチェーン証明書の発行 ・証明書の管理アプリの開発 (ヒツジハネタ) ࣗݾհ
教育機関・金融機関・自治体など ࣗݾհ 個人の見えざる価値を可視化する
Go Sendai 2020/7/4 Conference
Go言語+MicroServicesで構築していた 弊社サービスにDDDを導入してみました ・DDDを導入しようとしたきっかけ ・マイクロサービスから見たDDD ・Go言語から見たDDD(アーキテクチャ) ・所感
DDDは初心者です よくない設計もあるかも知れないので お気づきの方は懇親会で教えて下さい
Service A Service C Service B %%%ಋೖͷ͖͔͚ͬɹ サービスの数が増えてきた ◦◦を元にした設計 ✕✕な感じの設計
Service D Service E △△風な設計 つらい…
%%%ಋೖͷ͖͔͚ͬɹ → ちゃんとドキュメントを残せばいい? → 最小限にしたい → チームとして共通の設計認識を持って それを規律としていきたい 個々のサービスの設計思想がバラバラ&追えない
DDDはどうだろう??
Go言語 マイクロサービス
Go言語 マイクロサービス
ϚΠΫϩαʔϏε͔Βݟͨ%%%ɹ Service A Service C Service B DDDを元にした設計 DDDを元にした設計 Service
D Service E DDDを元にした設計 見やすい! レビューしやすい!
ϚΠΫϩαʔϏε͔Βݟͨ%%%ɹ Service A Service C Service B Service D Service
E 予期していなかった効果 → 境界づけられたコンテキスト 実はマージした方が いいのでは?
ϚΠΫϩαʔϏε͔Βݟͨ%%%ɹ それまで 「責務の分離」に応じてサービスを区切っていた DDD導入後 BUT 意外にそこの解釈は人による… 基準ができた!
Go言語 マイクロサービス
(Pݴޠ͔Βݟͨ%%%ɹ Go言語の特徴 ・実行速度が速い ・並列処理が簡単 ・シンプルな言語構造 Class構文がない Interfaceはある でも継承はない
(Pݴޠ͔Βݟͨ%%%ɹ どういうこと? type dog struct { id uint name string
} func(d *dog) Cry() string { return “Bow!" } type Animal interface { Cry() string } func test(a Animal) { fmt.Printf(a.Cry()) } メソッドは構造体(struct)に紐付ける Interfaceに定義されたメソッドと 同じものが定義された構造体はそ のInterfaceとして使用できる
(Pݴޠ͔Βݟͨ%%%ɹ Goで有名な考え方 accept interfaces, return structs. 関数はインターフェースを受け入れて 構造体を返すように作りましょう
type someStc struct { id uint name string } type
SomeIf interface { CreateStc() someStc } func Test(i SomeIf) *someStc { return i.CreateStc } (Pݴޠ͔Βݟͨ%%%ɹ Func Interface ダックタイピングに近い Interfaceは使う人が定義する (同じpackage内とか) Struct
(Pݴޠ͔Βݟͨ%%%ɹ IssueCertificate() Issuerドメイン 証明書を発行して ストレージに格納 S3 GCS ファイル システム Storage
Adapter S3 Adapter 外から渡す インターフェースは どこで定義する?
(Pݴޠ͔Βݟͨ%%%ɹ Issuerドメイン IssueCertificate() Storage Adapter S3 Adapter Interfaceは使う人が定義 シンプルになった!
まとめ ・マイクロサービスの設計に明確な基準ができた ・「accept interfaces, return structs.」の 考え方を使えば置き場所の悩みがスッキリする 懸念 ・Interfaceの置き方がコレでいのかという
不安はある。詳しい方の見解聞きたい!
ありがとうございました!
More Decks by hitsuji-haneta
See All by hitsuji-haneta
SSIで覗き見るPWAの世界 / SSI on PWA
hitsuji_haneta
2
1.2k
やってみたよVueNative
hitsuji_haneta
2
520
これもフロントエンド!画面つきスピーカーで遊んでみた
hitsuji_haneta
0
120
VueではじめるWeb Components
hitsuji_haneta
1
610
webエンジニア向けブロックチェーンの技術的「へぇ」 / Blockchain tech tips for web developers
hitsuji_haneta
0
180
Other Decks in Programming
See All in Programming
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
520
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
520
vue-tsc x TypeScript7
koukimiura
0
110
Going Full Circle with Virtual Graphs and Relational Databases
michaelsimons
1
120
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
1.2k
AppFunctionsの内部実装を紐解く
hiroaki404
1
130
The Cost of the DOM
ypresto
3
1.2k
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
350
Datadog を OTel にするメリットを考察する — Datadog との併用を実アプリで確かめる / Examining the Benefits of Moving Datadog to OTel — Testing OTel Alongside Datadog in a Real App
seike460
PRO
1
110
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
Kiro Crewによる開発体験ーKiro CrewでStrands Decider 2B に関する技術検証をやってみた
satoshi256kbyte
1
230
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
15k
Speed Design
sergeychernyshev
33
2.3k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
620
My Coaching Mixtape
mlcsv
0
400
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
680
[SF Ruby Conf 2025] Rails X
palkan
3
1.6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
2k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k