# Domain Modeling Made Functional 筆記 (序言) ***Sam Xiao, Jun.03, 2020*** ## Overview 很多人認為 FP 就是 `數學`、`抽象` 與 `很難懂的 Code`,在本書將證明 FP 很適合以 DDD 建立 Domain Model,並且產生很乾淨、精簡的 Design。 ## Outline [TOC] ## Who is This Book For ? 本書適合以下資深工程師: * 想看看如何只用 Type 與 Function 來建立 Domain Model * 想看看 DDD 是什麼 ? 它與 OOAD 與 Database-first Design 有什麼差異呢 ? * 你熱愛 DDD 並且想知道為什麼 FP 適合 DDD ? * 想要學習 FP,但總被其理論與抽象打敗 * 想看看 F# 與 FP 如何在實務中使用 您不需要在閱讀本書之前了解 DDD 或 FP,本書將會從頭講解。 ## What's in This Book ? 本書共分成三部分: * Understanding the Domain * Modeling the Domain * Implementing the Model 每個章節彼此都有相關,建議依照順序閱讀。 ### Understanding the Domain * Ch.01:Introducing Domain-Driven Design * Ch.02:Understanding the Domain * Ch.03:A Functional Architecture 第一部分將介紹 DDD 重要概念:`Shared Model`、`Event Storm`、`Decompose Domain`、`Ubiquitous Language` ... 等,本書重點不在深入介紹 DDD,而在使用 FP 與 DDD 建立 domain model。 ### Modeling the Domain * Ch.04:Understanding Types * Ch.05:Domain Modeling with Types * Ch.06:Integrity and Consistency in the Domain * Ch.07:Modeling Workflows as Pipelines 實際以 FP 對 domain 中的 workflow 建立 domain model,我們將會看到 FP 與 OOP 的不同,也會看到如何以 type 來建立 model。 最後將以精簡的 code 完成以下目標: * 為 Domain 設計出可讀性高的文件 * 為第三部分設計出可實作的架構 ### Implementing the Model * Ch.08:Understanding Functions * Ch.09:Implementation:Composing a Pipeline * Ch.10:Implementation:Working with Errors * Ch.11:Serialization * Ch.12:Persistence * Ch.13:Evolving a Design and Keeping It Clean 將以 FP 技術如 composition、partial application、monad ... 等實作第二部分所設計的架構。 本書並沒有包含所有 FP 技術,僅介紹足夠建立 domain model 部分,但已經包含 FP 最精要部分。 ## Other Approaches to Domain Modeling 本書介紹的是主流 domain modeling 方式,也就是藉由定義 data structure 與 function。 * 若 domain 圍繞在 semistructured data 則不適用本書方式,而適合以 map (dictionary) 這種彈性的 data structure,Clojure community 常用此方式 * 若 domain 強調在組合 element 成其他 element,也就是重點是其 composition rule (algebra) 而非 data,如 financial contract 或 graphic design tool 這些 domain 也適合 functional 方法,但本書因為篇幅限制未討論這類 domain ## Conclusion * 本章節簡單介紹本書內容與架構,也點出尚有不適合本書方式的 domain 與其他 建立 domain model 方法 ## Reference [Scott Wlaschin](https://twitter.com/ScottWlaschin?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor), [Domain Modeling Made Function Preface](https://pragprog.com/book/swdddf/domain-modeling-made-functional)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up