Use ORM in your domain model when rate of change is low

Authors: Kenny Baas-Schwegler

Submitter: Kenny Baas-Schwegler

When can it be appropriate to use ORM mapping in my domain model?

Short description

When your domain model does not change quickly you can decide to use a ORM mapping framework (for instance: JPA, EntityFramework) in your domain. This way we don't need to create mapping between the domain model and the repository model.

Examples

A user inbox for keeping communication message to the customer, this does not change that fast.

Context

When we implement domain models with hexagonal or clean architecture we need to seperate the domain model from the repository model and create mappers. For small domains that don't change fast this can be a lot of work.

Tags

Follow us

Read our latest news from Virtual DDD on any of these social networks!

Recent heuristics

Align with domain experts

Short description Align boundaries with the parts of the domain where there are different domain experts (not different people but different domain skills/knowledge). Context We should align boundaries in sociotechnical systems with our business processes to minimise...

Align bounded context with the value stream

Short description Align bounded contexts in socio-technical systems to support the value stream of the business. Use these at a strategic level when you are in a position to understand the value stream of the business. Examples For example, in an ecommerce company...