DI(Dependency Injection)について理解する

DI(Dependency Injection)とはよく「依存性の注入」と訳される。 しかし、自分の中では「依存性」も「注入」もいまいちピンときていないので詳しく調べた。

下記ブログの記事がとてもわかり易かった。 nekogata.hatenablog.com

DI(Dependency Injection)とは

英語版のWikipediaではDIの説明として、以下のようにある。

In software engineering, dependency injection is a technique whereby one object (or static method) supplies the dependencies of another object.
Dependency injection - Wikipedia

他のオブジェクトに依存しているオブジェクトのことのようだ。

依存が高いと

参考

DI (依存性の注入)っていったいなんだ? - Qiita

Dependency Injectionを「依存性の注入」と訳すのは非常に悪い誤訳 - little hands' lab

猿でも分かる! Dependency Injection: 依存性の注入 - Qiita