2
votes

In the book "Implementing Domain-Driven Design" by Vaughn Vernon it is said on page 120 that

Application Services reside in the Application Layer. [...]. They may control persistence transactions [...]".

enter image description here

  1. Now, the Controller in a MVC application is an application service, right?
  2. If yes, does it mean that the controller can commit or roll back a database transaction (directly or indirectly, but through a mecanism that the controller can manage)?
1
Controllers provide access to application services via HTTP. Application services may also be accessed via console. Inside controllers, I instantiate application services, and execute them.Geoffrey

1 Answers

4
votes

You can view Controllers as Application Services, especially in simple applications, but it might be a better idea to have dedicated objects for these services because :

  • Controller is a UI concept. You might want to change or add a UI layer and still keep the applicative scenarios intact without rewriting them.

  • Orchestrating calls to Repositories, domain entities and services plus carrying out applicative transactions might be too much responsibility for a Controller that is already in charge of dealing with View data and View navigation. See the Fat Controller antipattern.