Clean Architecture, UseCases and Entities

落爺英雄遲暮 提交于 2019-12-06 16:50:31

Quite a lot questions within a single question. let me try to consolidate what I think I understood are ur key questions

  • Can Entities reference each other? the answer would be: YES. Also in Clean Architecture u can create a domain model where entities are interconnected

  • What should be returned from a UseCase? Answer: UseCases define input DTOs (Data transfer objects) and output DTOs which are most convenient for the use case. in his book uncle bob writes that entities should not be passed to use cases or returned from use cases

  • What is the role of the presenter then? Answer: ideally a presenter is converting data only. It converts data which is most convenient for one layer into data which is most convenient for the other layer.

hope this guidance helps u to answer ur detailed questions

More details and examples you can find in my recent posts: https://plainionist.github.io/Implementing-Clean-Architecture-UseCases/ and https://plainionist.github.io/Implementing-Clean-Architecture-Controller-Presenter/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!