- 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
推薦閱讀
- FreeSWITCH 1.8
- 程序員面試筆試寶典
- Mastering QGIS
- React.js Essentials
- Mastering Ext JS
- 微信小程序入門指南
- 從零開始學C語言
- Creating Stunning Dashboards with QlikView
- C語言程序設計
- Python極簡講義:一本書入門數據分析與機器學習
- Spring技術內幕:深入解析Spring架構與設計原理(第2版)
- 和孩子一起學編程:用Scratch玩Minecraft我的世界
- PostgreSQL 12 High Availability Cookbook
- C Primer Plus(第6版)中文版【最新修訂版】
- 跟小樓老師學用Axure RP 9:玩轉產品原型設計