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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
820
Other Decks in Programming
See All in Programming
作るコストが小さくなった時代 幸せに働くために改めて考えたいこと 〜エンジニアとして価値を出し続けるために注視している二分野〜
yuppeeng
0
180
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
140
Android CLI
fornewid
0
210
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
200
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
180
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
480
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
170
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
140
AIが無かった頃の素敵な出会いの話
codmoninc
1
380
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
仕様駆動開発の消費期限
watany
7
2k
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
410
Featured
See All Featured
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
400
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
630
A Modern Web Designer's Workflow
chriscoyier
698
190k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
270
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
200
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
Building Applications with DynamoDB
mza
96
7.2k
Mind Mapping
helmedeiros
PRO
1
300
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
30 Presentation Tips
portentint
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で書きやすいライブラリは未整備な状態。