Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a Data Transfer Object the same as a Value Object?

Is a Data Transfer Object the same as a Value Object or are they different? If they are different then where should we use a DTO and where should we use a VO?

The programming language we are talking about is Java and the context is - there is a web application, which fetches data from a database and then processes it and ultimately the processed information is displayed on the front-end.

like image 701
Gaurav Avatar asked Jan 12 '12 06:01

Gaurav


People also ask

Is a DTO a Value Object?

DTO is a class representing some data with no logic in it. On the other hand, Value Object is a full member of your domain model. It conforms to the same rules as Entity. The only difference between Value Object and Entity is that Value Object doesn't have its own identity.

What is the meaning of data transfer objects?

A data transfer object (DTO) is an object that carries data between processes. You can use this technique to facilitate communication between two systems (like an API and your server) without potentially exposing sensitive information. DTOs are commonsense solutions for people with programming backgrounds.

What is difference between DTO and Vo?

DTO: "Data transfer objects " can travel between seperate layers in software architecture. VO: "Value objects " hold a object such as Integer,Money etc. POJO: Plain Old Java Object which is not a special object.

What is the difference between DTO and model?

Data Transfer Objects (DTOs) and View Models (VMs) are not the same concept! The main difference is that while VMs can encapsulate behaviour, DTOs do not. The purpose of a DTO is the transfer of data from one part of an application to another.


1 Answers

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.

like image 114
JuanZe Avatar answered Oct 14 '22 03:10

JuanZe