Even if you program to an interface the implementation class still needs to be instantiated somewhere.
即使您按接口编程,仍然需要在某个地方实例化实现类。
The first principle is: "Program to an interface, not an implementation."
第一条是:“面向接口编程,而非面向实现编程”。
Program to an interface, not an implementation.
面向接口编程,而不要面向实现编程。
Program to an interface, not an implementation.
针对接口而写编程,不要针对实现。
Program to an interface, not an implementation.
要针对接口编程,不要针对实现编程。
Abstractions should not depend upon details, details should depend upon abstractions. Program to an interface, not an implementation.
抽象不应该依赖于细节,细节应该依赖于抽象,要针对接口编程,不要针对实现编程。
Abstractions should not depend upon details, details should depend upon abstractions. Program to an interface, not an implementation.
抽象不应该依赖于细节,细节应该依赖于抽象,要针对接口编程,不要针对实现编程。
应用推荐