知识卡片
超类型只放真正共性
选择超类型的属性时核对其约束、语义和预期演进。名字与年龄可供各宠物共享,品种未来可能由不同分类系统管理。把表面同名的属性提早锁在基类会限制各子类的独立表达。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Designing schemas with composition in OpenAPI 16.2 Polymorphism and inheritance in domain models · 查看原书依据
Why didn’t we make the breed a common attribute? Well, while these attributes have the same name, we already mentioned that we may represent them differently in the system later on. Also, there’s always a chance that we’ll add a type of
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第16章《Designing schemas with composition in OpenAPI》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch16.htm,阅读块 54)
- 结论依据:原文以将来不同的 breed 表示说明字段同名仍不宜合并。
- 原始内容:Why didn’t we make the breed a common attribute? Well, while these attributes have the same name, we already mentioned that we may represent them differently in the system later on. Also, there’s always a chance that we’ll add a type of