为什么数据传输对象(DTO)是反模式? [英] Why are data transfer objects (DTOs) an anti-pattern?

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

问题描述

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

I've recently overheard people saying that data transfer objects (DTOs) are an anti-pattern.

为什么?有什么替代方案?

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.

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

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