About application rules on Clean Architecture #12
Unanswered
diogokobbi
asked this question in
Q&A
Replies: 1 comment
-
Good question. Use cases should be independent of the presentation layer. We could have any number of presentation devices but they should not impact the ApplicationService / UseCase. Going to your example: The ApplicationService class (or UseCase class) should be independent of the UI, so we don't use the word Mobile/Desktop in the name, nor anywhere else So the following are two valid options I see (whereby Use Cases remain decoupled from Presentation)
In this way, the presentation layer (Dekstop, Mobile, REST API) is sensitive to presentation needs... BUT the application layer does not know anything about Mobile/Desktop. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, i have a doubt about the Application layer on Clean Architecture Diagram. Our entities from domain layer have business rules, so we have a central point to validate operations, but what about the application layer? should we have the same behaviour there for specific uses cases?
Let me give a example: here in Brazil our banking systems do not allow some operations on mobile applications, only on desktop apps. So, how do we apply our rules to block or hide some info for specific apps? Where theses rules should belong to?
I tought that uses case methods of each application (mobile and desktop) should be responsible for that, but some examples available on github show only one application (like UserService, for example) in the application layer. I'm talking about something like this:
// 2 projects on application layer:
// On this use case implementation, we hide (block or format) entity data to display?
// display all info
// 2 projects on external layer::
// calls WebApi project that depends on MobileAppplicationService
// calls WebApi project that depends on DesktopAppplicationService
Maybe my example is not clear enough. A food delivery app can have the same issue: restaurant and client share the same Order Entity, but each one has different views and operations on presenter layer. Where should those specific rules for each presenter belong to?
If we attach business logic in the presenter layer, we cannot evolve a restaurant webform application to React SPA without lose or rewrite application rules, for example.
Beta Was this translation helpful? Give feedback.
All reactions