DDD and application layer

Is the application layer (service applications) where I add @Dateful, @Stateless, @WebService, etc. in DDD? From the link below, this seems to be correct.

Second question: I created a repository class, should all method calls associated with the repository be wrapped in the application service? Or can I use repository classes directly in let say backing beans in JSF? When and what I insert into the application layer. I do not understand where EJB belong to this art.

Application Level: This layer coordinates application activity. It does not contain business logic. It does not support the state of business objects, but it can support the execution state of an application.

http://www.infoq.com/articles/ddd-in-practice

+3
source share
2 answers

Java EE protects the anemic model, which is the opposite of DDD. If you want DDD, your entities must also follow business logic, which contradicts the separation of service level and objects.

+6
source

It was assumed that in the DDD architecture, the application layer and the entire other layer interact only with the lower level of the system. For this reason, service application wrapper repositories, but if you use the inyection dependency, you can reuse all your repositories at the application service level.

The real work of AppService is to coordinate operations with other services or repositories or inclusive domain services.

Your entities should only have business logic about your own entities. Always respecting the principle of single responsibility ( http://www.developerfusion.com/article/137636/taking-the-single-responsibility-principle-seriously/ ).

I hope you find it helpful

0
source

Source: https://habr.com/ru/post/1396991/


All Articles