Tag: Domain Model
All the articles with the tag "Domain Model".
-
[DDD Intro #26] Explaining domain models with tests
Tests are usually seen as tools for preventing bugs. That is true. Tests check whether code behaves as expected and help prevent changes from breaking existing behavior.
-
[DDD Intro #21] ORM and DDD: Is a JPA Entity a domain model?
When talking about DDD in a Java and Spring environment, JPA almost inevitably comes up. The word Entity overlaps. JPA has Entity, and DDD has Entity. So many teams naturally use JPA Entities as their domain models.
-
[DDD Intro #19] Layered Architecture: Protecting the domain layer
When we try to implement DDD, architecture soon enters the conversation. Names such as Presentation Layer, Application Layer, Domain Layer, and Infrastructure Layer appear. We split packages, decide dependency direction, and separate responsibilities by layer.
-
[DDD Intro #18] Specification and Policy: Modeling conditions and policies
Domain logic starts as small conditionals. If it is in a certain state, do not process it. If a certain date has passed, expire it. If it is a certain plan, do not discount it. At first, a few if statements are enough.
-
[DDD Intro #17] Factory: Creation also contains domain knowledge
Object creation is often treated as a simple technical problem. It is easy to think that we only need to call a constructor, pass the needed values, and fill fields. But in a domain model, creation can also be an important behavior.
-
[DDD Intro #16] Domain Service: Domain logic that is hard to force into an object
When studying DDD, we often hear that "domain logic should be inside domain objects." This is important. If domain rules scatter into Application Services or Controllers, the model becomes anemic.
-
[DDD Intro #13] What it means to put behavior into domain objects
Even when a team says it applies DDD, domain objects often do almost nothing in real code. Class names look domain-like, such as Subscription, Order, and Payment, but inside they only have fields, getters, and setters. Most important rules live in service classes such as SubscriptionService, OrderService, and PaymentService.
-
[DDD Intro #12] Entity: A domain object with identity and lifecycle
A Value Object is identified by value. 10,000 won is 10,000 won, and a period with the same start date and end date is the same period. What matters is the value itself.