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
JavaScript+DDD実践編?
Search
KAZUMA Ukyo
December 05, 2013
8
35k
JavaScript+DDD実践編?
KAZUMA Ukyo
December 05, 2013
Tweet
Share
More Decks by KAZUMA Ukyo
See All by KAZUMA Ukyo
Functional JavaScript/TypeScript
yaakaito
4
1.2k
モデリングをはじめよう
yaakaito
3
360
Head First TypeScript
yaakaito
2
2.4k
JavaScript TDD Bootcamp
yaakaito
0
150
"Buster.JS" ClinetSide Javascript testing
yaakaito
4
1.1k
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
42
6.7k
The Brand Is Dead. Long Live the Brand.
mthomps
48
21k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
58
14k
Robots, Beer and Maslow
schacon
PRO
154
7.9k
WebSockets: Embracing the real-time Web
robhawkes
59
6.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
8
8.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
257
12k
Design by the Numbers
sachag
274
18k
Large-scale JavaScript Application Architecture
addyosmani
501
110k
Scaling GitHub
holman
456
140k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
111
35k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
28
5.9k
Transcript
JavaScript × DDD ࣮ફฤ KAZUMA UKYO
ϨΠϠʔԽ ɹΞʔΩςΫνϟ ΤϯςΟςΟ όϦϡʔ ɹΦϒδΣΫτ ϦϙδτϦ ϢϏΩλεݴޠ େنઃܭ ϦϑΝΫλϦϯά ΞάϦήʔτ
ࠓ ͢ Δ ͓ ࠓ ͠ ͳ ͍ ͓
ೋ෦ͷલͷྫ
ʮϢϏΩλεݴޠͱ͔Կͱͳ͔͚ͬͨ͘Ͳɺ ɹ࣮ࡍΞϓϦέʔγϣϯ࡞ͬͨΒͲ͏ͳΔͷʁʯ ͱ͍͏Λ͠·͢
ϞσϦϯάͷ͠·ͤΜ
౿ΈࠐΜͩ͠·ͤΜ ͋͘·ͰงғؾͱҰྫ
ઌʹݴ͓͖ͬͯ·͕͢
ઌʹݴ͓͖ͬͯ·͕͢ ᘳͳઃܭͳ͍
ϨΠϠʔԽ ΞʔΩςΫνϟ Layered Architecture
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure event
observing Callback Callback Callback event observing event observing
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure View
Controller Model
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure View
ViewModel Model
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure Ϗϡʔ
ΞϓϦέʔγϣϯͷ ϩδοΫ ήʔϜϩδοΫ API௨৴ / ֎෦࿈ܞ
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure jQuery
Backbone.view Backbone.model underscore
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure jQuery
Backbone.view Backbone.model underscore ?
υϝΠϯ Domain
؆୯ʹݴ͑ ϏδωεϩδοΫ
ྫ͑ Ϣʔβʔ είΞܭࢉϩδοΫ Χʔυͷใ
ྫ͑ Ϣʔβʔ είΞܭࢉϩδοΫ Χʔυͷใ ͍ΘΏΔϞσϧͱ͍͏ͭ
Ϟσϧͷදݱ େ͖͚ͯ͘ೋछྨ
ΤϯςΟςΟͱ όϦϡʔΦϒδΣΫτ Entity / Value object
7BMVFPCKFDU &OUJUZ ಉҰੑ͕͋Δ ಉҰੑ͕ͳ͍ Մೳ ϦϙδτϦ ӬଓԽ ͷ*0ͷ୯Ґ ෆՄೳ ڞ༗Մೳͳͷ
ϦϙδτϦ Repository
υϝΠϯͷݴ༿Λͬͯ &OUJUZΛ*0͢Δ
ྫ͑ "1*͔Βऔಘ -PDBM4UPSBHFʹΩϟογϡ
ऀ͕ଗ͖ͬͯͨͷͰཧ
ϢʔβʔΠϯλʔϑΣΠε User interface ΞϓϦέʔγϣϯ Application υϝΠϯ Domain ΠϯϑϥετϥΫνϟ Infrastructure jQuery
Backbone.view Backbone.model underscore Entity Value object Repository
ྫ Example
Ϣʔβʔͷ ϓϩϑΟʔϧϖʔδΛදࣔ
User interface Application Domain Infrastructure UserView UserViewModel / Controller UserRepository
$.ajax API Ϣʔβʔද͍ࣔͨ͠Ͱ͢ "1*͔Β͍ͩ͘͞ event observing aυʔκ User
ϢʔβʔΛ৽ن࡞
User interface Application Domain Infrastructure UserRegisterView UserViewModel / Controller $.ajax
API ͜͏͍͏ใೖྗ͞Ε·ͨ͠ ใΛݩʹ6TFS࡞Γ·͢ event observing User UserRepository "1*ʹ͛ͯ ొ͍ͯͩ͘͠͞ User
ϢʔβʔΛߋ৽
User interface Application Domain Infrastructure UserUpdateView UserViewModel / Controller $.ajax
API χοΫωʔϜมΘͬͨ ରͷϢʔβʔ͍ͩ͘͞ event observing User UserRepository User.updateNickname User ม͑ͨͷͰอଘ͍ͯͩ͘͠͞
Ϧετͷϖʔδϯά
User interface Application Domain Infrastructure UserListView UserListViewModel / Controller UserRepository
$.ajax API )PHFΛ·ͣݸද͍ࣔͨ͠Ͱ͢ "1*͔Β ݸ͍ͩ͘͞ event observing aυʔκ User User User User ࠓݸ͋Γ·͢ ݸग़·ͨ͠
User interface Application Domain Infrastructure UserListView UserListViewModel / Controller UserRepository
$.ajax API ʮଓ͖ΛಡΉʯ͠·ͨ͠ "1*Ͱ ൪͔Β ݸ͍ͩ͘͞ event observing aυʔκ User User User User ࠓ̎ݸ͋Γ·͢ ࠓݸ͋Γ·͢ ݸग़·ͨ͠
൪֎ฤ੩తϖʔδͷදࣔ
User interface Application Domain Infrastructure HelpView $.ajax aυʔκ ϔϧϓϖʔδ͘Ε ੩త͔ͩΒυϝΠϯͱ͔ͳ͍
ϊ
ʮηϯηʔʂ+40/͡ΌବͳΜͰ͔͢ʁʯ
ʮବͰ͢ʯ
+40/Λ ͦͷ··͏ͳ +40/ϞσϧͰ͋Γ·ͤΜ
+40/ ΠϯϑϥετϥΫνϟ ͘͠ ΞϓϦέʔγϣϯ Ͱղܾ͠·͠ΐ͏
͋ͱࠓճ#BDLCPOFΛྫʹग़͠·͕ͨ͠ɺ $P$ܥͷϑϨʔϜϫʔΫͱ͋Μ·Γ૬ੑྑ͘ͳ͍Ͱ͢
ৄ͘͠ຊಡΊ