The pattern which is known today as Data Transfer Object was mistakenly (see this definition) called Value Object in the first version of the Core J2EE Patterns. The name was corrected in the second edition of the Core J2EE Patterns book, but the name "Value Object" became very popular and is still used as an alias for the actual DTOs. There is, however, a real difference between both patterns:
1. A Data Transfer Object (DTO) is just as stupid data container which is used to transport data between layers and tiers. It mainly contains of attributes. Actually you can even use public attributes without any getters / setters, but this will probably cause too much meetings and discussions :-). DTOs are anemic in general and do not contain any business logic. DTOs are often java.io.Serializable - its only needed if you are going to transfer the data across JVMs.
2. A Value Object [1,2] represents itself a fix set of data and is similar to a Java enum. A Value Object doesn't have any identity, it is entirely identified by its value and is immutable. A real world example would be Color.RED, Color.BLUE, SEX.FEMALE etc.
Data Transfer Objects are widely overused and the "real" Value Objects a bit unattended. Most developers who use the term Value Object actually have in mind DTOs.
Original: http://www.adam-bien.com/roller/abien/entry/value_object_vs_data_transfer
分享到:
相关推荐
登陆的dto.zip
这是关于值对象(VO)模式和数据传输对象(DTO)模式的初学者教程,并附有示例。值对象是其相等性基于值而不是标识的对象。数据传输对象是用于移动数据的数据容器。
如果想生成未预置的代码,如vo对象、前端vue页面以及其他自定义代码等,需要做一些定制和扩展来实现。 从使用角度而言,官方资料介绍得比较简要,要实际使用,仍然需要进行具体的尝试和摸索,包括必要时看下源码...
PO可以严格对应数据库表,一张表对映一个PO。... VO:value object值对象、view object视图对象 PO:持久对象 QO:查询对象 DAO:数据访问对象——同时还有DAO模式 DTO:数据传输对象——同时还有DTO模式
J2EE基础知识之DTO,VO,PO,DO等定义J2EE基础知识之DTO,VO,PO,DO等定义J2EE基础知识之DTO,VO,PO,DO等定义
org.geotools.arcsde.data org.geotools.arcsde.data.versioning org.geotools.arcsde.data.view org.geotools.arcsde.filter org.geotools.arcsde.gce org.geotools.arcsde.gce.band org.geotools.arcsde.gce...
标签:apollo-dto-1.0-javadoc.jar,apollo,dto,1.0,javadoc,jar包下载,依赖包
java简单基础 需要的了解一下 我们大家还是有必要去区分的
Java中 PO VO BO DTO DAO 和 POJO 关系图
Register user buffer memory and initialize passive rdma dto descriptor. Data size is stored in task->data[ISER_DIR_IN].data_len, Protection size os stored in task->prot[ISER_DIR_IN].data_len.
NULL 博文链接:https://eddysoft.iteye.com/blog/1941484
modify the property file of the database path, driver, user name, password, enter CMD to the D drive is running java-jar kingdao.jar disk in D test folder under the root directory of DAO and DTO ...
NULL 博文链接:https://ewf-momo.iteye.com/blog/1738853
标签:apollo-dto-1.7.jar,apollo,dto,1.7,jar包下载,依赖包
OpenPath.Dto.Generic.Payment 概括 通用数据对象,包含与不同类型的支付卡相关联的标准数据。 Bin property 概括 银行识别码(BIN)是出现在卡上的开头的四到六个数字。 银行识别号唯一地识别发行卡的机构。 在将...
个人对DTO这种设计模式的一些粗略见解。
Generate POJO-JPA-Swagger-DTO
python库。 资源全名:lol_dto-0.1a10.tar.gz