- 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
推薦閱讀
- Advanced Machine Learning with Python
- Java多線程編程實戰指南:設計模式篇(第2版)
- SOA實踐
- Learning Docker
- Mastering Objectoriented Python
- PHP 從入門到項目實踐(超值版)
- Reactive Programming with Swift
- Wireshark Network Security
- VSTO開發入門教程
- INSTANT CakePHP Starter
- Python:Master the Art of Design Patterns
- 網站構建技術
- 深入淺出PostgreSQL
- 劍指Java:核心原理與應用實踐
- Mastering Web Application Development with AngularJS