clean-architecture - 为什么要有请求模型?

标签 clean-architecture

创建请求模型对象并将其传递给交互器的基本原理是什么?

为什么不直接将数据作为参数传入并跳过分配?对我来说,这似乎是一个非常短暂的对象。

我错过了什么?

最佳答案

来自鲍勃叔叔的书“整洁建筑”:

The use case class accepts simple request data structures for its input, and returns simple response data structures as its output. These data structures are not dependent on anything. They do not derive from standard framework interfaces such as HttpRequest and HttpResponse. They know nothing of the web, nor do they share any of the trappings of whatever user interface might be in place.

关键方面是“请求数据结构”(注意“s”)是独立且简单的数据结构。不必为每个交互器创建专用的请求模型类型,只要您传递给交互器的数据结构是您的编程语言/环境(例如 .Net 或 Java)的原语,或者您已在用例层中定义了它们.

关于clean-architecture - 为什么要有请求模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55780386/

相关文章:

c# - 使用具有复杂过滤器语法的外部 API

c# - 在 Entity Framework Core 中使用 Fluent API 编写范围数据注释

ios - 在整洁的架构中使用 NSFetchedResultsController

android - 使用适配器设计模式和 Jetpack 分页将整洁架构原则应用于 recyclerview 分页

java - Android Clean 架构中的登录流程

unit-testing - 测试在 Clean 架构中做不止一件事的 Interactor 方法

Flutter BLoC - Bloc vs Cubit 事件驱动状态管理优势

database - 整洁架构 : Sequence Flow Among Frameworks

Android Clean Architecture - 访问资源字符串的正确方法

flutter - 对于Flutter,MVVM架构和Reso Coder的简洁架构有何不同?