$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
STYLE
koic
0
150
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
150
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
380
Microservices rules: What good looks like
cer
PRO
0
1.1k
無秩序からの脱却 / Emergence from chaos
nrslib
2
13k
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
200
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
160
Integrating WordPress and Symfony
alexandresalome
0
140
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
6
300
生成AIを利用するだけでなく、投資できる組織へ
pospome
0
230
connect-python: convenient protobuf RPC for Python
anuraaga
0
380
SwiftUIで本格音ゲー実装してみた
hypebeans
0
110
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Thoughts on Productivity
jonyablonski
73
5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Code Review Best Practice
trishagee
74
19k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
390
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
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で書きやすいライブラリは未整備な状態。