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
Hai Feng Kao
June 23, 2022
Programming
920
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
模組化的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
190
模組化的Swift架構(一) Redux入門
haifengkao
0
160
日常生活中的腦殘
haifengkao
0
290
機器學習超入門
haifengkao
0
190
UICollectionView自動布局
haifengkao
1
470
宅宅設計入門2
haifengkao
2
310
宅宅設計入門
haifengkao
5
330
Other Decks in Programming
See All in Programming
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
React本体のコードリーディング
high_g_engineer
1
150
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.8k
Building a Meta Ray-Ban display app
akkeylab
0
170
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
540
プロポーザルを書いてもらう
pvcresin
0
570
MySQLとPostgreSQLって何が違うの?
akagami
0
130
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
190
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
370
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
240
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
500
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
160
Featured
See All Featured
How GitHub (no longer) Works
holman
316
150k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
480
Un-Boring Meetings
codingconduct
0
390
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
380
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
500
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Automating Front-end Workflow
addyosmani
1369
210k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
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
共享程式碼
防腐層