Skip to content
Rain Hu's Workspace
Go back

[IT] Clean Architecture

Rain Hu

乾淨架構

設計(design)與架構(architecture)為何重要?

行為(behavior)與架構(architecture)

程式設計範式(paradigms)

物件導向設計:

小結:

SOLID 設計原則

SRP: 單一職責原則(The Single Responsibility Principle)

OCP: 開放封閉原則(The Open-Closed Principle)

LSP: 里氏替體原則(The Liskov Substitution Principle)

ISP: 介面隔離原則(The Interface Segregation Principle)

DIP: 依賴反轉原則(The Dependency Inversion Principle)

DIP3

組件原則

可搬遷性(relocatabbility)

連結器(linkers)

內聚三原則

REP(The Reuse/Release Equivalence Principle)

CCP(The Common Closure Principle)

CRP(The Common Reuse Principle)

耦合(Coupling)

非循環依賴原則(The Acyclic Dependencies Principle, ADP)

  1. 應用 DIP 依賴反轉,創造介面,打破循環。
  2. 創建一個新的組件,使兩者共同依賴於新的組件。

由上自下的設計(Top-Down Design)

穩定依賴原則(The Stable Dependencies Principle, SDP)

穩定性指標

I=fan-outfan-in + fan-outI=\frac{\text{fan-out}}{\text{fan-in + fan-out}}

不是所有的組件都應該是穩定的

穩定抽象原則(The Stable Abstractions Principle, SAP)

測量抽象性 A 指標


Share this post on:

Previous
[IT] Clean Architecture - 第4章 - 結構化程式設計
Next
[IT] 事件總線 EventBus