数据模型和对象模型有什么区别?

发布于 2024-08-25 07:32:32 字数 63 浏览 6 评论 0原文

CWM 是数据建模

UML 是对象建模。

有人可以解释一下外行可以理解的区别吗?

CWM is data modeling

UML is object modeling.

Can someone explain the difference that a layman can understand?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尛丟丟 2024-09-01 07:32:32

对象模型:处理系统的面向对象“蓝图”。这包括类图(您将创建的类)、这些类之间的关系、类中的方法、属性等。

数据模型:处理数据库级别的实体。比如 OM 中的类如何存储在数据库中、存储在哪些表中等。所以 DM 处理表模式、不同表之间的关系(PK、FK)等。DM

没有复杂的 OO 功能,如多态性、继承、重载等通常列在 OM 中。

作为一个粗略的示例,OM 中的两个类可以存储(映射)到 DM 中的单个表,就像员工和经理人员可以存储在单个数据库表中一样。

Object Model: deals with object oriented "blue-print" of your system. This includes, class diagrams (classes you will be creating), relationship between these classes, methods in the classes, properties etc.

Data model: deals with entities at the database level. Like how the classes in the OM will get stored in the database, in which tables etc. So DM deals with Table schema, relationship between different tables (PKs, FKs) etc.

DM does not have complex OO features like polymorphism, inheritance, overloading etc which are usually listed in an OM.

As a rough example, two classes in the OM can get stored (mapped) to a single Table in the DM, like both Employee and Manager persons can be stored in a single DB table.

|煩躁 2024-09-01 07:32:32

数据建模涉及数据库结构的设计和创建,即。数据如何存储。

对象建模涉及应用程序如何与从外部源(例如最终用户、数据库、Web 服务等)接收的信息进行交互。

例如,假设您正在跟踪销售部门的客户历史记录。该部门需要客户的姓名、地址、电话、电子邮件和购买历史记录。

在数据模型中,您定义将存储每条数据的表和字段。在该定义中,您可以包含最大长度、数据类型或是否需要数据等信息。

在对象模型中,除了强制执行您在数据模型中设置的规则之外,您还可以添加其他行为,例如确保电子邮件地址的格式正确,或者将客户名字和姓氏的首字母大写。这些类型的规则往往比数据模型中设置的规则更加复杂和详细。

无论如何,对象模型的目的是简化应用程序本身内数据的管理,并在数据发送到数据库之前对数据执行更高级别的验证。

Data modeling deals with the design and creation of your database structure, ie. how the data is stored.

Object modeling deals with how the application interacts with the information received from an external source, e.g. an end-user, a database, a web service, etc.

Let's say, for example, you are tracking customer history for the sales department. The department needs the customer's name, address, phone, email, and purchase history.

In the data model, you define the tables and fields that will store each individual piece of data. In that definition, you may include information like the maximum length, data type or whether or not the data is required.

In the object model, in addition to enforcing the rules you set up in the data model, you may also add additional behaviors, such as making sure that the email address is formatted correctly, or capitalizing the first letter of the customer's first and last name. These type of rules tend to be more complex and detailed than the rules set within the data model.

At any rate, the purpose of the object model is to ease the management of the data within the application itself and to perform higher-level validation on the data before it gets sent to the database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文