以数据为中心和面向对象的应用程序模型有什么区别? [英] What is the difference between data-centric and object-oriented application models?

查看:46
本文介绍了以数据为中心和面向对象的应用程序模型有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是以数据为中心的应用程序,它与面向对象的应用程序模型有什么区别?

What is a data-centric application and is there any difference with an object-oriented application model ?

推荐答案

这两个概念有些正交,一个 Data Centric Application 是数据库发挥关键作用的地方,数据库中的属性可能会影响应用程序中运行的代码路径,并且代码更通用并且所有/大多数业务逻辑都是通过数据库关系和约束定义的.OOP 可用于创建以数据为中心的应用程序.

The two concepts are somewhat orthogonal, a Data Centric Application is one where the database plays a key role, where properties in the database may influence the code paths running in your application and where the code is more generic and all/most business logic is defined through database relations and constraints. OOP can be used to create a data centric application.

当人们说 OOP 架构在代码中实现业务逻辑和只需将数据存储在数据库中.然而,认为面向对象设计必然是一个庞大的业务逻辑系统是错误的.

Some of the large multi-tier architectures which people think of when they say OOP architecture implement business logic in code and just store the data in the database. However, it would be wrong to think Object Oriented design necessarily has to be a large business logic ridden system.

假设您必须实现两个系统之间的消息传递.一种方法(虽然不好)是让每个系统将消息写入数据库,而另一个系统每隔一段时间从数据库中读取一次以获取消息.这将是一种以数据为中心的方法,因为除了读取和写入数据之外,几乎不需要任何代码.

Say you have to implement message passing between two systems. One way (although a bad way) is to have each of the systems write the messages to the database and the other system read from the database every so often to pick up messages. This would be a data centric approach as there is very little code needed other than reading and writing data.

可以通过让系统彼此打开套接字连接并直接发送消息来实现相同的系统.通过这种方式有更多的代码和更少的数据库访问.这是非以数据为中心的方法.这些都可以使用 OOP 概念来实现.

The same system could be implemented by having the systems open a socket connection to each other and send messages directly. In this way there is more code and less database access. This is the non-datacentric approach. Either of these could be implemented using OOP concepts.

我工作的另一个例子是我们为游戏实现服务器,一种类型的服务器处理多人游戏,因此用户按下按钮,宇宙飞船向其他玩家发射导弹.该服务器不是以数据为中心的,而是基于事件的.另一台服务器存储用户的高分、好友列表等,该服务器是存储分数和列表的数据库的薄包装器.

Another example from my work we implement servers for games, one type of server handles multi-player game play so user presses the button and spaceship fires missile at other player. This server is not datacentric it is event based. Another server stores the users high scores, friend lists etc this server is thin wrapper over the database which stores the score and lists.

这篇关于以数据为中心和面向对象的应用程序模型有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆