知识卡片

普通读书笔记卡 · 3287

接缝是可替换的交互点

理解等级:中级

接缝是两个代码单元相互连接的位置。通过接口和依赖注入让协作者可替换,测试便可使用替身而不用启动整个系统;遗留代码缺少清晰接缝时,应先识别并切断依赖,再补测试和改动。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      The concept of “seams” was first introduced in Michael Feather’s 2004 book Working Effectively with Legacy Code (Pearson). A seam is a point where functionality is stitched together—it can be considered as the point where one subject under consideration3 interacts with another. This is usually achieved by techniques like dependency injection, injecting the collaborator and executing against an interface allowing for substitutability. The substitutability

    参考来源

    - 位置:《Mastering API Architecture》第8章《Redesigning Applications to API-Driven Architectures》之《Creating APIs as “Seams” for Extension》(源文件:_epub-src/OEBPS/ch08.xhtml) - 结论依据:原文定义 seam 为交互点,说明依赖注入与替身测试,并列出遗留代码拆接缝的步骤。 - 原始内容:The concept of “seams” was first introduced in Michael Feather’s 2004 book Working Effectively with Legacy Code (Pearson). A seam is a point where functionality is stitched together—it can be considered as the point where one subject under consideration 3 interacts with another. This is usually achieved by techniques like dependency injection, injecting the collaborator and executing against an interface allowing for substitutability. The substitutability