5

服务层到底接收和返回什么对象。服务层的中转对象应该是什么 O?

 3 years ago
source link: https://www.v2ex.com/t/789552
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Java

服务层到底接收和返回什么对象。服务层的中转对象应该是什么 O?

  golangLover · 1 天前 · 553 次点击
最近看阿里巴巴的编程规范都绕晕了。

controller 接受的 VO,一时有人说是 view object, 一时有人说是 value object. 文章抄来抄去,不知道哪个对。

传进 service 层的时候到底是进来的时候就转换成 dto,还是把 vo 作为入参。返回出去的时候到底是返回一个 dto,还是返回一个 VO?

service 层之中 例如远端返回一个复杂 json,然后我就选了几个参数作为一个暂时对象。但这对象我也不准备直接返回出去,而是打算再和其他数据聚合,再返回甚至不返回。那么这个暂时的对象,他是属于 VO 吗,还是属于 dto 什么的。
这个暂时对象是作为内部类写在同一个文件里呢,还是分类为什么对象呢。这个命名的问题也困扰了我很久。

先感谢大家。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK