我应该命名一个将两个表映射到一起的表格? [英] What should I name a table that maps two tables together?
问题描述
假设我有两个表格:
Table: Color
Columns: Id, ColorName, ColorCode
Table: Shape
Columns: Id, ShapeName, VertexList
b $ b
我应该调用将颜色映射到形状的表格。
Table: ???
Columns: ColorId, ShapeId
推荐答案
中只有两个难点计算机科学:缓存无效
和命名的东西
- Phil Karlton
表示多对多
关系的表的好名字使得关系更容易阅读和理解。有时找到一个伟大的名字是不平凡的,但通常值得花一些时间思考。
Coming up with a good name for a table that represents a many-to-many
relationship makes the relationship easier to read and understand. Sometimes finding a great name is not trivial but usually it is worth to spend some time thinking about.
例如: Reader
和报纸
。
A
读者
和阅读器
有许多报纸
您可以调用关系 NewspaperReader
,但是像 Subscription
You could call the relationship NewspaperReader
but a name like Subscription
might convey better what the table is about.
名称 Subscription
也更为惯用,如果你想映射表
The name Subscription
also is more idiomatic in case you want to map the table to objects later on.
命名多对多
表的约定是一个名称的连接涉及关系的两个表。 ColourShape
将是一个明智的违约。也就是说,我认为Nick D 提出了两个很棒的建议: Style
和 Texture
。
The convention for naming many-to-many
tables is a concatenation of the names of both tables that are involved in the relation. ColourShape
would be a sensible default in your case. That said, I think Nick D came up with two great suggestions: Style
and Texture
.
这篇关于我应该命名一个将两个表映射到一起的表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!