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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
640
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
Kotlin JVM用に作られたライブラリのKMPを前提とした再設計
jsoizo
0
240
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
210
Promiseの向こう側へコンテキストを届ける ― proposal-async-context
seriseri
0
190
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
160
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
210
Stage 3でも仕様は変わる。アプリケーション開発者のためのTC39プロセスの読み方
bicstone
1
290
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
450
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
将来の標準フォーマッター?ktfmtを深堀る
t45k
1
250
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
430
Featured
See All Featured
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
790
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
Designing for Performance
lara
612
70k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
How to build a perfect <img>
jonoalderson
1
6.3k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
530
GraphQLとの向き合い方2022年版
quramy
50
15k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.3k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
500
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450