data-transfer-objects

Difference between Transfer objects and Domain objects

自作多情 提交于 2019-12-03 02:18:23
问题 Could you please explain the difference between Transfer objects and Domain objects in simple terms ? And if u could give a Java example, that would be great.. 回答1: DTOs don't have any logic. They only have fields (state). They are used when transferring data from one layer/subsystem to another Domain objects can have logic (depending on whether you are using domain-driven design or have anemic data model) and they are usually related to the database structure. If using anemic data model (i.e

How much business logic should Value objects contain?

China☆狼群 提交于 2019-12-02 23:32:27
One mentor I respect suggests that a simple bean is a waste of time - that value objects 'MUST' contain some business logic to be useful. Another says such code is difficult to maintain and that all business logic must be externalized. I realize this question is subjective. Asking anyway - want to know answers from more perspectives. Panagiotis Korros You should better call them Transfer Objects or Data transfer objects (DTO) . Earlier this same j2ee pattern was called 'Value object' but they changed the name because it was confused with this http://dddcommunity.org/discussion

Difference between Value Object pattern and Data Transfer pattern

跟風遠走 提交于 2019-12-02 19:42:46
In which scenario can I use those design patterns in n-tier architecture? DTO is the object that you can use at the boundaries of the system. When you have a SOAP web service for example and you want to return response you would use DTO. It easier to deal with than actual XML that has to be returned over the wire. DTOs are often generated by tools, based on WSDL for example. DTO are often tailored to the needs of service consumer and can be affected by performance requirements. Value objects on the other hand live in the core of the system. It captures pieces of business logic and maybe

Difference between Transfer objects and Domain objects

时光毁灭记忆、已成空白 提交于 2019-12-02 15:48:37
Could you please explain the difference between Transfer objects and Domain objects in simple terms ? And if u could give a Java example, that would be great.. DTOs don't have any logic. They only have fields (state). They are used when transferring data from one layer/subsystem to another Domain objects can have logic (depending on whether you are using domain-driven design or have anemic data model) and they are usually related to the database structure. If using anemic data model (i.e. your domain objects don't have any logic), DTO and domain object can be the same object. Related: http:/

DTO or Domain Model Object in the View Layer?

a 夏天 提交于 2019-11-28 13:54:59
问题 I know this is probably an age-old question, but what is the better practice? Using a domain model object throughout all layers of your application, and even binding values directly to them on the JSP (I'm using JSF). Or convert a domain model object into a DTO in the DAO or Service layer and send a lightweight DTO to the presentation layer. I have been told it makes no sense to use DTOs because changes to the database will result in changes to all your DTOs whereas using Model Objects

Java data transfer object naming convention?

依然范特西╮ 提交于 2019-11-27 17:01:41
Given this scenario where you have "transfer objects" (POJO's with just getters/setters) which are passed by a client library to your API, what is the best way to name the transfer objects? package com.x.core; public class Car { private String make; private String model; public Car(com.x.clientapi.Car car) { this.make = car.getMake(); this.model = car.getModel(); } } In this example your main class and your transfer object both have the name Car . They are in different packages but I think it's confusing to have the same name. Is there a best practice on how to name the transfer objects? I

Why should I isolate my domain entities from my presentation layer?

牧云@^-^@ 提交于 2019-11-27 10:02:06
One part of domain-driven design that there doesn't seem to be a lot of detail on, is how and why you should isolate your domain model from your interface. I'm trying to convince my colleagues that this is a good practice, but I don't seem to be making much headway... They use domain entities where ever they please in the presentation and interface layers. When I argue to them that they should be using display models or DTOs to insulate the Domain layer from the interface layer, they counter that they don't see the business value in doing something like that, because now you have a UI object

Java data transfer object naming convention?

[亡魂溺海] 提交于 2019-11-26 18:46:57
问题 Given this scenario where you have "transfer objects" (POJO's with just getters/setters) which are passed by a client library to your API, what is the best way to name the transfer objects? package com.x.core; public class Car { private String make; private String model; public Car(com.x.clientapi.Car car) { this.make = car.getMake(); this.model = car.getModel(); } } In this example your main class and your transfer object both have the name Car . They are in different packages but I think it

Why should I isolate my domain entities from my presentation layer?

寵の児 提交于 2019-11-26 14:59:49
问题 One part of domain-driven design that there doesn't seem to be a lot of detail on, is how and why you should isolate your domain model from your interface. I'm trying to convince my colleagues that this is a good practice, but I don't seem to be making much headway... They use domain entities where ever they please in the presentation and interface layers. When I argue to them that they should be using display models or DTOs to insulate the Domain layer from the interface layer, they counter

Why are data transfer objects (DTOs) an anti-pattern?

廉价感情. 提交于 2019-11-26 14:06:01
I've recently overheard people saying that data transfer objects (DTOs) are an anti-pattern . Why? What are the alternatives? KLE Some projects have all data twice . Once as domain objects, and once as data transfer objects. This duplication has a huge cost , so the architecture needs to get a huge benefit from this separation to be worth it. Gabe Moothart DTOs are not an anti-pattern. When you're sending some data across the wire (say, to an web page in an Ajax call), you want to be sure that you conserve bandwidth by only sending data that the destination will use. Also, often it is