2017年4月7日 星期五

OOP - Dependency-Inversion Principle


重點:program to an interface,  not an implementation


原本上層的類別會依賴下層的類別,就如同要蓋二樓就必須蓋好一樓
但 Dependency-Inversion Principle 的意思就是應該要讓上層和下層都依賴於抽象層,也就是上面重點說的 interface



http://teddy-chen-tw.blogspot.com.au/2012/01/5dependency-inversion-principle.html

沒有留言:

張貼留言