DDD journey: what's the difference between a domain service and an application service?

Posted on July 15, 2021

Foreword

In the series of my short DDD journey articles, I’ll summarize some of the insights that came out speaking with the author of the Advanced Web Application Architecture book.

Thanks to the author, you can get it with a special discount reserved to the readers of this blog!

Application and domain services

One of the points that I didn’t get immediately while reading Noback’s book was the purpose of domain services, compared to application services.

After asking the author to shed some light, I got the difference.

We can think of application services as use cases, e.g., order an e-book or give me the list of available e-books.

In other words, application services represent what a client (usually called primary actor) can do with our application.

Application services belong to the core, precisely to the application layer.

Conversely, domain services can be considered implementation details, e.g., calculate the order total.

They also belong to the core, encapsulated into the domain layer.

Thus, domain services are used inside the domain and not directly exposed to the clients of our application.

Enjoy!


Posted with : ddd