$30 off During Our Annual Pro Sale. View Details »
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
760
Other Decks in Programming
See All in Programming
アーキテクチャと考える迷子にならない開発者テスト
irof
9
3.4k
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
200
Evolving NEWT’s TypeScript Backend for the AI-Driven Era
xpromx
0
220
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
24
19k
最新のDirectX12で使えるレイトレ周りの機能追加について
projectasura
0
320
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 1
philipschwarz
PRO
0
110
20 years of Symfony, what's next?
fabpot
2
150
Microservices rules: What good looks like
cer
PRO
0
130
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
120
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
150
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
110
[SF Ruby Conf 2025] Rails X
palkan
0
390
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Site-Speed That Sticks
csswizardry
13
970
Six Lessons from altMBA
skipperchong
29
4.1k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Statistics for Hackers
jakevdp
799
230k
Raft: Consensus for Rubyists
vanstee
140
7.2k
Designing for humans not robots
tammielis
254
26k
Rails Girls Zürich Keynote
gr2m
95
14k
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で書きやすいライブラリは未整備な状態。