为查找表建模系统对象
我正在创建对象查找表,但不确定到底要调用什么对象。这是一个社交网络。我知道照片、视频、状态等项目都是对象,但是帐户设置、邮件文件夹、邮件附件、错误消息等呢?像“标签”这样的东西本身就是一个对象,还是只有当我们将它与照片标签、视频标签、人物标签等结合起来时才成为一个对象?
我们是否使用系统对所有对象进行 1 对 1 建模,或者具有用于查找目的的父对象和子对象?
I am creating the object lookup table and not sure what exactly to call an object. This is a social network. I know items like photo, video, status etc are objects but what about account settings, mail folders, mail attachments, error messages, etc? Some things like "Tags" is that an object by itself or only when we combine it with Photo tag, Video tag, Peopletag, etc?
Do we model all objects 1 to 1 with system or have parent objects and child objects for lookup purposes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您指的是数据库模式,您应该这样想。
如果两个错误在语义上相同(即“foo”==“foo”),那么它可以变成一个查找表。如果两个名字在语义上不相同,即使它们具有相同的值(即“john”==“john”但人不同),那么您不应该使用查找表。
对于标签之类的内容,您可能需要使用查找表,但如果它们将由用户输入,则最好将它们作为字符串保留在数据库中。查找表最适合用于大型对象(以减少存储)或不经常更改的值。虽然也有例外,但这是一个很好的经验法则。
这有道理吗?
埃里克
If you are referring to a database schema, you should think of it like this.
If two errors are semantically the same (i.e., "foo" == "foo"), then it can be turned into a lookup table. If two names are semantically not the same, even if they have the same value (i.e., "john" == "john" but the persons are different), then you shouldn't use a lookup table.
For things like tags, you might want to use a lookup table, but if they will be entered by the user, it is probably better to keep them as strings in the database. Lookup tables are best used for large objects (to reduce storage) or values that don't change often. There are exceptions to this, but it's a good rule of thumb.
Does this make sense?
Erick