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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
790
Other Decks in Programming
See All in Programming
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1k
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
860
AHC061解説
shun_pi
0
410
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
200
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
240
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
500
Ruby and LLM Ecosystem 2nd
koic
1
1.2k
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.5k
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
230
Java 21/25 Virtual Threads 소개
debop
0
220
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
6
1.1k
OTP を自動で入力する裏技
megabitsenmzq
0
120
Featured
See All Featured
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
570
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Odyssey Design
rkendrick25
PRO
2
550
Code Reviewing Like a Champion
maltzj
528
40k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
How STYLIGHT went responsive
nonsquared
100
6k
Prompt Engineering for Job Search
mfonobong
0
210
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
160
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
450
Making the Leap to Tech Lead
cromwellryan
135
9.8k
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で書きやすいライブラリは未整備な状態。