I'm struggling a little bit with Domain Driven Design because there are so many names and concepts to grasp.
Today it striked me to know what is exactly the difference between an 'application service' and an 'use case'. Are they the same thing?
I'm struggling a little bit with Domain Driven Design because there are so many names and concepts to grasp.
Today it striked me to know what is exactly the difference between an 'application service' and an 'use case'. Are they the same thing?
In Clean Architecture jargon, use cases are indeed similar to DDD Application Services. In UML though, use cases refer to broader business scenarios rather than a technical layer.
No, they are not the same thing. Use case is a meaningful operation performed by your application. As a part of it, it can call other sub-operations in other bounded contexts. That sub-operations are implemented as application services in monolithic applications and are meaningful only as a part of a use case. Those are good candidates for becoming microservices in the microservice architecture. The use case, in turn, becomes a separate microservice calling these microservices.
Example: you create a booking via REST. The controller gathers the input and invokes a "reserveRoom" use case in Booking bounded context. The use case, in turn, calls the AvailabilityService in Availability bounded context to decrement the number of available rooms and PaymentService to check the validity of the credit card.