1.背景介绍
Dependency injection (DI) and Inversion of Control (IoC), two fundamental principles in software design, are not easy to understand for developers who have not had a close look at them before. The difficulty lies in the fact that DI and IoC can be applied to many different programming paradigms such as object-oriented programming (OOP), functional programming (FP), procedural programming (PP) or even event-driven programming (EDP).
To help make things clearer for beginners and experts alike, we will present an overview of these concepts based on real-world examples and use cases from OOP, FP, PP and EDP. We'll also discuss how DI and IoC are used in popular frameworks such as Spring Framework and AngularJS.
The purpose of this article is