Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the differece between a 'Use Case Interactor' and a 'Service' in Clean Architecture?

I don't really understand the difference between a Use Case Interactor and a Service in Clean Architecture. Is a domain service just a collection of "Use Case Interactor methods"?

I want to implement the clean architecture in my ASP.net Core Application, but i am not sure if I should implement it in the "Use Case Interactor" way (https://fullstackmark.com/post/18/building-aspnet-core-web-apis-with-clean-architecture), the "Service" way (https://github.com/ardalis/CleanArchitecture) or if I should combine them (if possible at all).

like image 720
Christoph Hummler Avatar asked Aug 14 '19 07:08

Christoph Hummler


People also ask

What is a use case Interactor?

In Clean Architecture "use case" and "interactor" means the same: it is the component which contains business logic. The presenter in this architecture does not contain any business logic.

What is a use case in Clean Architecture?

Uses Cases as the Units of Work In practice, a use case is just a function (a query or a command) that should ideally be pure — deterministic and without side effects. Side effects are supposed to be delegated. A use case is like an algorithm to accomplish a client-driven task. ( Clean Architecture for the rest of us)

What is use case in Android architecture?

Use cases show us the intent of the software. They describe the behavior of a system and its interactions with users. They are likely the first thing to be listed when we think about a new application. Despite the above, it seems to me that the role of the use case is not entirely clear within the Android community.

What is Domain layer in Clean Architecture?

The domain layer is an optional layer that sits between the UI layer and the data layer. Figure 1. The domain layer's role in app architecture. The domain layer is responsible for encapsulating complex business logic, or simple business logic that is reused by multiple ViewModels.


1 Answers

Strictly speaking, the term "Domain Service" does not exist in Uncle Bob's Clean Architecture but in DDD. In Clean Architecture all business logic goes to Use Case Interactors and Entities. So if you want to strictly follow Uncle Bob's architecture, follow the Use Case Interactors way described in the first article you linked.

For a more detailed discussion on use cases and use case Interactors pls refer to my post: http://www.plainionist.net/Implementing-Clean-Architecture-UseCases/

like image 147
plainionist Avatar answered Nov 07 '22 15:11

plainionist