Table Module

老马说:
A single instance that handles the business logic for all rows in a database table or view.
我说:一个实例操作所有一个数据库表或视图的业务逻辑。
One of the key messages of object orientation is bundling the data with the behavior that uses it
面向对象设计的一个关键点是把数据和操作他们的行为包装在一起。
The traditional object-oriented approach is based on objects with identity, along the lines of Domain Model 。
传统的面向对象设计方法是建立在对象的一致性基础之上的,沿着业务对象链。哈哈
Thus, if we have an Employee class, any instance of it corresponds to a particular employee.
因此,如果我们有一个(Employee类),所有它的实例符合一个特殊的(Employee)。
This scheme works well because once we have a reference to an employee, we can execute operations, follow relationships, and gather data on him.
这个设计能很好的工作,因为一但我们有一个对象的接口,我们就可以执行它的方法,关联关系,和在它身上收集数据。
One of the problems with Domain Model (116) is the interface with relational databases.
业务对象的一个问题在于和关系数据库的交互。
 In many ways this approach treats the relational database like a crazy aunt who's shut up in an attic and whom nobody wants to talk about.
许多时候这种办法不能处理关系型数据库。
As a result you often need considerable programmatic gymnastics to pull data in and out of the database, transforming between two different representations of the data.
结果是你通常要考虑怎么把数据从数据库中取出插入,使其在不同的表现方式上转换。
A Table Module organizes domain logic with one class per table in the data-base, and a single instance of a class contains the various procedures that will act on the data.
Table Module用一个在数据库中的表来组织业务逻辑,它的一个实例包含许多不同的操作数据库的方法。
The primary distinction with Domain Model (116) is that, if you have many orders, a Domain Model (116) will have one order object per order while a Table Module will have one object to handle all orders.
和业务对象最大的不同是,如果你有许多的Orders,一个业务对象用一个Order对象来表达一个Order,而Table Module则用一个对象来表示所有的Orders。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值