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
模組化的Swift架構(二) DDD速成
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Hai Feng Kao
June 23, 2022
Programming
900
0
Share
模組化的Swift架構(二) DDD速成
2022/6/21 ios@Taipei分享
介紹Domain Driven Design
Hai Feng Kao
June 23, 2022
More Decks by Hai Feng Kao
See All by Hai Feng Kao
物件導向的文藝復興:用DCI重塑程式設計的藝術
haifengkao
0
170
模組化的Swift架構(一) Redux入門
haifengkao
0
160
日常生活中的腦殘
haifengkao
0
290
機器學習超入門
haifengkao
0
180
UICollectionView自動布局
haifengkao
1
460
宅宅設計入門2
haifengkao
2
310
宅宅設計入門
haifengkao
5
330
Other Decks in Programming
See All in Programming
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
260
Migrations : C'est une question d'hygiène !
vinceamstoutz
0
880
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
450
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
500
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
4
510
iOS26時代の新規アプリ開発
yuukiw00w
0
180
cloudnative conference 2026 flyle
azihsoyn
1
200
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
190
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
3
420
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
850
My daily life on Ruby
a_matsuda
3
430
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
160
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
760
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
370
Measuring & Analyzing Core Web Vitals
bluesmoon
9
830
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
150
Building the Perfect Custom Keyboard
takai
2
770
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
260
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Building an army of robots
kneath
306
46k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
The SEO Collaboration Effect
kristinabergwall1
1
450
Designing for Performance
lara
611
70k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
Transcript
Domain Driven Design速成 Hai Feng Kao 2022/6/21 模組化的Swift架構(⼆)
Domain Driven Design • 以領域(domain)為核⼼的設計思維 • 常⾒的設計思維 • UI驅動 •
資料庫驅動 • API驅動 • 領域驅動 • 隕⽯驅動
開發流程
開發流程
• ⽤來設計電路的程式⼀定要有 • 電阻、電容、腳位 • 銀⾏轉帳程式⼀定要有 • 活儲帳⼾、定存帳⼾、⾦額 • 叫⾞app⼀定要有
• ⾞型、上⾞地點、路線、下⾞地 點 必也正名乎
六⾓形架構 https://vaadin.com/blog/ddd-part-3-domain-driven-design-and-the-hexagonal-architecture
領域模型 https://dotblogs.com.tw/regionbbs/2021/05/29/anemicdomainmodel
貧⾎模型 https://dotblogs.com.tw/regionbbs/2021/05/29/anemicdomainmodel
DDD的設計模式
https://speakerdeck.com/softleader/ru-he-jin-xing-dddshi-zuo-fe25e1b7-db0c-4d53-99b1-8ed9d1ca4837?slide=7
• 給backend⽤的 • 只有main thread DDD程式的運作流程 https://speakerdeck.com/softleader/ru-he-jin-xing-dddshi-zuo-fe25e1b7-db0c-4d53-99b1-8ed9d1ca4837?slide=12
• 收到Request • 從Respository取出物件 (Aggregate Root) • 呼叫物件的⽅法來處理資料 • 把處理完的資料(Aggregate
Root) 存回Repository Backend運作流程
• 收到Request • 從Respository取出物件 (Aggregate Root) • 呼叫物件的⽅法來處理資料 • 把處理完的資料(Aggregate
Root) 存回Repository Backend運作流程 • 使⽤者打開App • ⼿指點⼀點 • 呼叫物件的⽅法來更新畫⾯ • ⼿指滑⼀滑 • 呼叫物件的⽅法來更新畫⾯ App運作流程
• 收到Request • 從Respository取出物件 (Aggregate Root) • 呼叫物件的⽅法來處理資料 • 把處理完的資料(Aggregate
Root) 存回Repository Backend運作流程 • 使⽤者打開App • ⼿指點⼀點 • 呼叫物件的⽅法來更新畫⾯ • ⼿指滑⼀滑 • 呼叫物件的⽅法來更新畫⾯ App運作流程 狀態被完整地保存在Repository 狀態被保存在UIKit、SwiftUI、第三⽅套件、⾃⼰寫的物件
• 有領域 • 單機⼿遊 • 繪圖app、記事本、⾳樂播放軟體 • 沒有領域 • 呼叫API把傳回的資料呈現在畫⾯
上 • 所以的邏輯判斷都由backend負責 把DDD應⽤在App上
• 有領域 • 單機⼿遊 • 繪圖app、記事本、⾳樂播放軟體 • 沒有領域 • 呼叫API把傳回的資料呈現在畫⾯
上 • 所以的邏輯判斷都由backend負責 把DDD應⽤在App上 佔99.9% 0.1%
如何設計模組化的App架構? 把DDD應⽤在App設計 https://betterprogramming.pub/ios-app-modularisation-the-starting-point-1419db0474ed
模組之間如何溝通? 把DDD應⽤在App設計 https://betterprogramming.pub/ios-app-modularisation-the-starting-point-1419db0474ed
限界上下⽂
六⾓形架構 https://vaadin.com/blog/ddd-part-3-domain-driven-design-and-the-hexagonal-architecture
共享程式碼
防腐層