首页 > Python基础教程 >
-
C#教程之入门(2)
Summary
总结
In this chapter, you have seen how you can address some of the common requirements in enterprise applications such as maintainability and testability by adopting a loosely coupled design for your application. You saw a very simple illustration of this in the code samples that show two different ways that you can implement the dependency between the ManagementController and TenantStore classes. You also saw how the SOLID principles of object-oriented programming relate to the same concerns.
However, the discussion in this chapter left open the question of how to instantiate and manage TenantStoreobjects if the ManagementController is no longer responsible for this task. The next chapter will show how dependency injection relates to this specific question and how adopting a dependency injection approach can help you meet the requirements and adhere to the principles outlined in this chapter.
在本章中,您已经了解了如何通过为您的应用程序采用松耦合设计来解决企业应用程序中的一些常见要求,如可维护性和可测试性。您在代码示例中看到了一个非常简单的例子,它展示了两种不同的方法,您可以实现ManagementController和TenantStore类之间的依赖关系。另外你也看到面向对象SOLID原则如何设计涉及这些关注。
但是,本章讨论遗留一个问题,如果ManagementController不再负责这个任务,那么如何实例化和管理TenantStore 对象。在下一章将会显示使用依赖注入如何与具体问题相关和采用依赖注入方法如何帮助您满足要求并遵守本章中概述的原则。
More Information