- Hands-On Dependency Injection in Go
- Corey Scott
- 160字
- 2021-06-10 19:17:48
How does this relate to DI?
As we have seen, the ISP helps us to break down interfaces to logically separate parts, with each part providing a particular feature—a concept sometimes referred to as a role interface. By leveraging these role interfaces in our DI, our code becomes decoupled from the concrete implementation of the inputs.
Not only does this decoupling allow parts of the code to evolve separately, but it also tends to make it easier to identify test vectors. In the previous example, it's easier to scan through the inputs one at a time and consider their possible values and states. This process might result in a list of vectors like the following:
Test vectors for the value input include:
- Happy path: Returns a valid value
- Error path: Returns an empty value
Test vectors for the monitor input include:
- Happy path: Does not return a done signal
- Error path: Immediately returns a done signal
推薦閱讀
- Dynamics 365 for Finance and Operations Development Cookbook(Fourth Edition)
- Intel Galileo Essentials
- Mastering Adobe Captivate 2017(Fourth Edition)
- Mastering Python Scripting for System Administrators
- 跟老齊學Python:輕松入門
- ADI DSP應用技術集錦
- SQL基礎教程(視頻教學版)
- 快速念咒:MySQL入門指南與進階實戰
- Linux Device Drivers Development
- Learning JavaScript Data Structures and Algorithms
- Mastering Docker
- Training Systems Using Python Statistical Modeling
- Visual C++程序設計與項目實踐
- Java Web動態網站開發(第2版·微課版)
- Python自動化運維:技術與最佳實踐