Exploring services
Services in DDD are divided into three types, but we will focus on the domain services for now, and then we will discuss the other two later: infrastructure services and application services.
A domain service is the unit within the DDD ecosystem where the business logic lives. A domain service has the following responsibilities:
- Loading domain objects through the help of repositories
- Applying business logic
- Persisting the domain objects with the help of repositories
It is important to understand that the domain services are unaware of how the data is loaded from the storage medium and how it is stored. They only know how to request a data-loading or persistence operation through the help of data repositories. Repositories will be covered later in this chapter.
Let’s add some services for our blog project to help us with publishing posts, and retrieving and updating them.
Post management
If you have ever published a blog...