ResponseModel and dictionary values

47 views
Skip to first unread message

Stefan Makarewicz

unread,
Jan 29, 2015, 7:54:24 AM1/29/15
to clean-code...@googlegroups.com
Hi.

I have some doubts. Should dictionary values be in response model (clean architecture)?

Small example. There is webpage with form to create own computer. User can choose CPU from list. Response model contain computer object. Should also contain List<CPU> allcpus or that dictionary can be "inject" to web page in other way (for example separate method with @ModelAttribute in Spring) ?

Regards,
Stefan

Dave Schinkel

unread,
Sep 5, 2015, 7:39:21 PM9/5/15
to Clean Code Discussion
Let me take a stab at this.

Sounds to me (tell me if I'm wrong) that you have an interactor object that is creating the response Model.  And you're somehow passing that response Model back up and back through the boundary somehow.

If so, Interactors contain business rules specific to the use case.  So I'd think that a response model would contain only data that would be used to fullfill the use case.  So to me, a blanket list of all CPUs, is another call, it's not something you'd include in the response Model.  The use case doesn't say that I need a list of all CPUs back, that wouldn't make sense, that's just data for a dropdown or something that you've gotten already somehow through some other call before, outside this use case for populating your dropdown.
Reply all
Reply to author
Forward
0 new messages