← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 8779.c · 生成模型:GPT-6

参数化扩展需有稳定共性

理解等级:中级

当新需求可通过已有参数表达而不修改核心实现,能减少针对每个场景的特殊分支。前提是抽象确实覆盖共同语义;不应通过过多参数把互不相关职责硬塞进一个通用函数。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      Open-closed design The open-closed principle states that software entities should be open for extension but closed for modification. This means that a system’s behavior can be extended without modifying its existing code. In our refactoring, when we created categorize_column() to replace the following complex implementation detail of converting Age from a continuous variable (0 to 100) to a binned ordinal variable (0, 1, 2, 3,

    参考来源

    - 位置:《Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)》第08章《重构与技术债》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)/_epub-src/OEBPS/ch08.html) - 结论依据:摘录中关于参数化扩展需有稳定共性的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:Open-closed design The open-closed principle states that software entities should be open for extension but closed for modification. This means that a system’s behavior can be extended without modifying its existing code. In our refactoring, when we created categorize_column() to replace the following complex implementation detail of converting Age from a continuous variable (0 to 100) to a binned ordinal variable (0, 1, 2, 3,