data-transfer-objects

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

夙愿已清 提交于 2019-11-26 03:03:34
问题 I\'ve recently overheard people saying that data transfer objects (DTOs) are an anti-pattern . Why? What are the alternatives? 回答1: 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. 回答2: 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

What is Data Transfer Object?

浪子不回头ぞ 提交于 2019-11-25 23:45:44
问题 What is a Data Transfer Object? In MVC are the model classes DTO, and if not what are the differences and do we need both? 回答1: A Data Transfer Object is an object that is used to encapsulate data, and send it from one subsystem of an application to another. DTOs are most commonly used by the Services layer in an N-Tier application to transfer data between itself and the UI layer. The main benefit here is that it reduces the amount of data that needs to be sent across the wire in distributed