知识卡片
含义与位置的共变
含义共变依赖各方理解某个值的隐含含义,位置共变依赖参数或数据的顺序。把魔法值改为具名常量可将前者降为较易治理的名称关联;两个字符串参数即使类型相同也可能传反,说明静态类型并不能替代语义与顺序约束。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 含义与位置的共变
原书出处 · 1 处
- Evolutionary Architecture Topologies · 查看原书依据
This is an issue with parameter values for method and function calls even in languages that feature static typing. For example, if a developer creates a method void updateSeat(String name, String seatLocation) and calls it with the values updateSeat("14D", "Ford, N"), the semantics aren’t correct even if the types are.
参考来源
- 位置:《Building Evolutionary Architectures Automated Software Governance, 2nd Edition》第05章《Evolutionary Architecture Topologies》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Building Evolutionary Architectures Automated Software Governance, 2nd Edition/_epub-src/OEBPS/ch05.html;段落定位:This is an issue with parameter values)
- 结论依据:原文对“含义与位置的共变”的定义或案例,支撑“含义共变依赖各方理解某个值的隐含含义,位置共变依赖参数或数据的顺序”的归纳。据其上下文,把魔法值改为具名常量可将前者降为较易治理的名称关联;两个字符串参数即使类型相同也可能传反,说明静态类型并不能替代语义与顺序约束。
- 原始内容:This is an issue with parameter values for method and function calls even in languages that feature static typing. For example, if a developer creates a method void updateSeat(String name, String seatLocation) and calls it with the values updateSeat("14D", "Ford, N"), the semantics aren’t correct even if the types are.