业务类和域类之间有什么区别?持久类是什么意思? [英] What is the difference between business class and domain class? What is meant by persistent classes?

查看:126
本文介绍了业务类和域类之间有什么区别?持久类是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

业务类和域类之间有什么区别?持久类是什么意思?

What is the difference between business class and domain class? What is meant by persistent classes?

推荐答案

域类域模型如下所示:rel ="noreferrer">企业应用程序体系结构的模式:

A domain class is a class from the Domain Model that Martin Fowler describes as follow in Patterns of Enterprise Application Architecture:

包含行为和数据的域对象模型.

An object model of the domain that incorporates both behavior and data.

在最糟糕的情况下,业务逻辑可能非常复杂.规则和逻辑描述了许多不同的情况和行为倾向,而正是对象设计用来处理这种复杂性.域模型创建了一个由相互连接的对象组成的网络,其中每个对象都代表某个有意义的个体,无论该个体大小与公司大小相同,还是与订单表上的一行一样小.

At its worst business logic can be very complex. Rules and logic describe many different cases and slants of behavior, and it's this complexity that objects were designed to work with. A Domain Model creates a web of interconnected objects, where each object represents some meaningful individual, whether as large as a corporation or as small as a single line on an order form.

对我来说,业务类没有什么区别:业务对象执行的业务逻辑不比域对象多或少(域模型是在域对象外部实现业务逻辑的域模型)域对象称为 Anemic域模型,这是一个贬义性术语),域对象和业务对象 是同一件事.

And to me, there is no difference with a business class: a business object doesn't perform more or less business logic than a domain object (a domain model where business logic is implemented outside the domain objects is called an Anemic Domain Model, which is a pejorative term), domain objects and business objects are the same thing.

最后,持久类是可以持久化的类,这意味着将内存中的信息表示形式转移到物理存储中,该物理存储将在JVM的生命周期之外持久化.通常,使用数据库来实现持久性(但这不是唯一的解决方案,例如,参见对象流行度).典型的持久性操作包括创建,读取,更新和删除,这被称为CRUD操作.域对象通常是持久性的,即您可以通过API对其执行CRUD操作,该API隐藏所选持久性引擎的基础细节.

Finally, a persistent class is a class that can be... persisted which means transferring an in memory representation of information to a physical storage that will persist beyond the live of the JVM. Often, persistence is implemented using a database (but this is not the only solution, see for example object prevalence). Typical persistence operations include create, read, update and delete which are known as CRUD operations. Domain objects are very frequently persistent i.e you can perform CRUD operations on them through an API that hides the underlying details of the chosen persistence engine.

这篇关于业务类和域类之间有什么区别?持久类是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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