Joshua is talking about classes that are gateways to resources like databases, filesystems, or all kinds of network resources. They are hard to replace with alternative implementations. If you just use regular classes, potentially implementing an abstract interface, you can inject them wherever they are needed and replace them by injecting something else instead. The prime example of such alternative implementations are Mocks/Stubs/Fakes used in unit tests where you do not want to access the actual underlying resources. Other examples:
- replace reading from JSON files by reading from YAML files
- replace reading/writing from/to one database system with something that reads/writes from/to another database system
- replace routing via google maps by reading from here.com
- etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…