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
5
3.7k
TypeScriptでDDD〜RepositoryとEntity編〜
We Are JavaScripters! @6th
https://wajs.connpass.com/event/54667/
Shinse Tanaka
April 30, 2017
Tweet
Share
More Decks by Shinse Tanaka
See All by Shinse Tanaka
PrimeNGという選択肢について
mrdshinse
0
780
Other Decks in Programming
See All in Programming
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
920
Oxlint JS plugins
kazupon
1
1.2k
ぼくの開発環境2026
yuzneri
1
300
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
330
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
1
140
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
4
370
CSC307 Lecture 14
javiergs
PRO
0
450
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1.1k
浮動小数の比較について
kishikawakatsumi
0
370
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
420
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
140
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
190
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
Docker and Python
trallard
47
3.8k
The Cult of Friendly URLs
andyhume
79
6.8k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
150
Odyssey Design
rkendrick25
PRO
2
530
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
140
The Limits of Empathy - UXLibs8
cassininazir
1
240
Being A Developer After 40
akosma
91
590k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
GraphQLの誤解/rethinking-graphql
sonatard
75
11k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
360
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で書きやすいライブラリは未整備な状態。