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
TypeScriptでDDD〜RepositoryとEntity編〜
Search
Shinse Tanaka
April 30, 2017
Programming
3.8k
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TypeScriptでDDD〜RepositoryとEntity編〜
We Are JavaScripters! @6th
https://wajs.connpass.com/event/54667/
Shinse Tanaka
April 30, 2017
More Decks by Shinse Tanaka
See All by Shinse Tanaka
PrimeNGという選択肢について
mrdshinse
0
830
Other Decks in Programming
See All in Programming
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
360
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
200
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
660
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
4
900
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
120
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
630
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.3k
FDEとは、何者なのか?
masapyon1212
0
140
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
210
信頼性の目標を誰も求めてない
shubox
0
490
typoなんかねぇよ
raspython3
0
660
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6.3k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
410
エンジニアに許された特別な時間の終わり
watany
108
250k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
810
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
660
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
720
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
260
Transcript
TypeScriptでDDD RepositoryとEntity編
自己紹介 ・不動産Techで働いてます。 ・Java/Scala/Ruby + ちょっとjs ・Web↔SI双方の技術を高めたい ・Node.js / TypeScriptでDDDしてみたい モチベーション
@mrdShinse @Shinse Tanaka
None
話すこと
https://github.com/mrdShinse/eve-linebot
ディレクトリ構成 ./app/application →アプリ起動時の設定やドメイン処理に 必要な前処理などを書く。 今回だとExpress.jsの起動。 ./domain →アプリケーションが解決したい問題や 業務の処理を書く。 ./infra →各レイヤーを実装するために必要な
具体的処理が書かれる。 今回だとMongo関係の処理。
ドメインとライブラリ依存を切り離したい
domainパッケージ
エンティティの定義 User →Entityとして定義。 nameはValueObject として定義する。
リポジトリ用読み書きインターフェース
ユーザーリポジトリの定義
domainパッケージにはmongoの処理を入れない! 続いてinfraパッケージ
Mongoリポジトリ共通親クラス
ユーザーリポジトリ
いい感じに
所感 ・TypeScriptのGenericsはいい ・TypeScriptでちゃんと設計してあげる事で・・・ (jsでそれ必要?という議論はあるがw) ・エンジニアの技術力の差を吸収することができる。 ・仕様の変更や依存ライブラリの変更に強くなる ・結果として、Node.jsで業務寄りなプログラムを書きやすくなる。 ・mongooseだとdomainとinfraの切り分けはできない・・・?``` ・DDDで書きやすいライブラリは未整備な状態。