为什么数据传输对象成为反模式? [英] Why are Data Transfer Objects an anti-pattern?

查看:266
本文介绍了为什么数据传输对象成为反模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近听到有人说,数据传输对象(DTO)是一种反模式



有人可以解释一下为什么吗?什么是替代方案?

解决方案

某些项目拥有所有数据两次。一次作为域对象,一次作为数据传输对象。



这个复制具有巨大的成本,所以架构需要从这种分离中获得巨大的收益才值得。

I've recently overheard people saying that Data Transfer Objects (DTO) are an anti-pattern.

Can someone please explain why? What are the alternatives?

解决方案

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.

这篇关于为什么数据传输对象成为反模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆