← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 4545.g.8.d.4.d

组装位置集中选择实现

理解等级:中级

工厂或启动入口根据显式配置选择日志和前端实现,把具体技术选择限制在组装边界。它不必依靠复杂注入框架,也不强求运行时插件。原稿示例存在环境变量字段对调与未定义标识符等问题,机制是隔离选择职责,不是宣称样例已经正确运行。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Loose Coupling · 查看原书依据

      More commonly you’ll see some kind of “factory” function11 that’s used by the initializing function. While this still requires code changes to add adapters, they’re isolated to a single, easily-modified location. A more sophisticated approach might use accept a parameter or configuration value to choose which adapter to use. An example of a TransactionLogger factory

    参考来源

    - 位置:《Cloud Native Go》第08章《Loose Coupling》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch08.xhtml) - 结论依据:工厂或启动入口根据显式配置选择日志和前端实现,把具体技术选择限制在组装边界。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。 - 原始内容:More commonly you’ll see some kind of “factory” function11 that’s used by the initializing function. While this still requires code changes to add adapters, they’re isolated to a single, easily-modified location. A more sophisticated approach might use accept a parameter or configuration value to choose which adapter to use. An example of a TransactionLogger factory