这取决于您的架构。如果您都在同一层,那么您可以不使用包装器,尽管我可能会将 View 实现的接口传递给 Controller。在功能上,从耦合的角度来看,接口方法和包装器方法是等价的。
但是,如果 UI 位于一层而控制器位于另一层,则传递/序列化整个 View 对象可能会很尴尬,甚至效率低下。在这种情况下,您可能希望来回传递 DTO,这将更容易序列化并且可能更有效。
我倾向于使用 DTO 方法,因为如果您的架构扩展,您需要做的就是序列化和反序列化。
此外,如果您的视图很复杂并且有大量数据要与控制器来回传递,那么您可能会开始使用Introduce Parameter Object来对抗 Long Parameter List 的气味,这本质上是一个 DTO。
One more thing for you to chew on: for a complicated View, Controller will end up needing to map lots of pieces of data to various text boxes and other UI controls in the View. The same thing in reverse: View ends up grabbing data from a lot of controls and passing them to various methods in your Controller.
I like separating these two. I give Views a DTO and I consider it the View's job to know where to "plug in" and "plug out" each piece of data. Both View and Controller are now coupled only to the DTO, as far as data is concerned anyway.