NISHIO Hirokazu[Translate]
依存性逆転の原則
Dependency inversion principle
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.

上位レベルのモジュールは下位レベルのモジュールに依存すべきではない。両方とも抽象に依存すべきである。
抽象は詳細に依存してはならない。詳細が抽象に依存すべきである。

「上位レベル」が「抽象度の高いモデル」ではないことに注意が必要。
あるモジュールXを利用するモジュール(=上位レベルのモジュール)が、
Xの実装の詳細に依存している(=Xの実装の詳細が変化した時に合わせて変化する必要がある)と、
上位レベルのモジュールはモジュールXの変更のたびに変更を迫られるか、
もしくはそれを嫌ってモジュールXを変更しないようにしようとする力学が働く。


"Engineer's way of creating knowledge" the English version of my book is now available on [Engineer's way of creating knowledge]

(C)NISHIO Hirokazu / Converted from [Scrapbox] at [Edit]