数据收集 目的与价值目标相同或不同? 如果它们不同,那么我们应如何使用DTO,我们应使用哪里的VO?
我们正在谈论的方案拟订语言是 Java,情况是:有网络应用程序,从数据库中收集数据,然后处理数据,最终在前端展示所处理的信息。
数据收集 目的与价值目标相同或不同? 如果它们不同,那么我们应如何使用DTO,我们应使用哪里的VO?
我们正在谈论的方案拟订语言是 Java,情况是:有网络应用程序,从数据库中收集数据,然后处理数据,最终在前端展示所处理的信息。
A value object is a simple object whose equality isn t based on identity. A data transfer object is an object used to transfer data between software application subsystems, usually between business layers and UI. It is focused just on plain data, so it doesn t have any behaviour.
A Data Transfer Object is a kludge for moving a bunch of data from one layer or tier to another, the goal is to minimize the number of calls back and forth by packing a bunch of stuff into the same data structure and sending it together. Some people also use it, like Michael points out in his post here, so that the classes used by one layer are not exposed to the layer calling it. When I refer to DTO as a kludge, I mean there s not a precise abstract concept getting implemented, it s a practical workaround for helping with communication between application layers.
A 价值 我们仅对其价值感兴趣,例如:monetary amount,一个日期范围,或一个代码:。 它没有身份,意思是,如果你有好几个人的话,你不会担心,因为他们本身不是事情。
避孕药具 那些在你系统中具有独特特性的物品,即所谓的实体。 如果你有一个跟踪客户付款的系统,客户和付款是实体,因为它们代表了具体事项,但付款上的货币数额只是一种价值,就你的系统而言,它本身并不存在。 贵系统如何确定是价值目标还是实体。
如果你不想将实际领域标的发送给服务客户,则在服务边界上使用DTO,这有助于减少客户与服务之间的依赖。
价值目标只是基于特性(例如,java.lang)的平等 t的物体。 分类
DTOs和价值物体是相互之间真正的替代物。
两者不同,但我甚至在过去用两种相互交换的方式,这是错误的。 我读到,DTO(Data Transfer Object)在核心J2EE模式书第一版中被称为“VO(价值目标),但找不到这一参考。
A DTO, which I ve sometimes called a Dumb Transfer Object to help me remember it s a container and shouldn t have any business logic is used to transport data between layers and tiers. It just should be an object with attributes that has getters/setters.
然而,宇宙航行科学院与JAVA Enum相似,是一套固定的数据。 宇宙航行科学院有物体特性(记忆中物体的地址),其价值是可变的。
Martin Fowler, talking about Data Transfer Objects (DTOs):
Many people in the Sun community use the term "Value Object" for this pattern. I use it to mean something else.
因此,“Value Object”一词被用在指DTO,但从他(和其他海报)来看,它作为DTO的使用似乎受到抑制。
Good detailed answer in Matthias Noback article Is it a DTO or a Value Object?
In short a DTO:
Declares and enforces a schema for data: names and types
Offers no guarantees about correctness of values
A value object:
Wraps one or more values or value objects
Provides evidence of the correctness of these values
Maybe because of lack of experience, but I would put it this way: It s the matter of scope.
DTO有文字转移,这意味着该系统的某些部分将使用该词。
价值物体的范围较小,你将采用价值物体的一组数据,而不是从一个服务到另一个服务。
As much as I understood niether of them is "object whose equality isn t based on identity".
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...