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
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
800
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
570
when storing skills in S3 file
watany
3
1.5k
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
150
過去のレビュー知見をSkillsで資産化した話
pkshadeck
PRO
1
1.7k
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
My daily life on Ruby
a_matsuda
3
200
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
130
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
1
680
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.6k
AWSはOSSをどのように 考えているのか?
akihisaikeda
0
100
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
500
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
400
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Why Our Code Smells
bkeepers
PRO
340
58k
Documentation Writing (for coders)
carmenintech
77
5.3k
How STYLIGHT went responsive
nonsquared
100
6.1k
Statistics for Hackers
jakevdp
799
230k
Un-Boring Meetings
codingconduct
0
280
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
210
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
500
The Curse of the Amulet
leimatthew05
1
12k
Thoughts on Productivity
jonyablonski
76
5.1k
WCS-LA-2024
lcolladotor
0
580
Between Models and Reality
mayunak
3
280
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で書きやすいライブラリは未整備な状態。