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
790
Other Decks in Programming
See All in Programming
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
22
13k
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
420
事業会社でのセキュリティ長期インターンについて
masachikaura
0
250
おれのAgentic Coding 2026/03
tsukasagr
1
150
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
400
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
210
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
180
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
220
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
1
180
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
3
340
Angular Signal Forms
debug_mode
0
110
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
130
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
180
エンジニアに許された特別な時間の終わり
watany
106
240k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
200
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
270
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Crafting Experiences
bethany
1
110
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
350
The agentic SEO stack - context over prompts
schlessera
0
750
Building AI with AI
inesmontani
PRO
1
900
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
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で書きやすいライブラリは未整備な状態。