I'm trying to get my head around DDD, and I understand that I have a domain object and a domain service.

My domain object is an interaction which can be different types of interactions with a client, like a meeting, telephone call, visit etc.

So I created an interaction service and now I want to create the logic if the current user is allowed to edit the interaction.

Now that is an extensive validation because the current user can be the creator, he can be delegated to edit it, he can be in the same usergroup the creator is in, he can be the teamlead, he can have interaction-edit-elevated-rights and the interaction must not be in the past, closed, on hold etc. etc.

Is this validation also a method on the interactionservice? As it must check the database for multiple things I understand it can not be on the interaction object itself. Do I create a canedit(int userid) method and then also a candelete(userid) method on the interactionservice or do I create a separate interactionallowedactionsservice or do I handle it on another way?


1 Answer 1


Seperate the check for user authorization (creator, delegated to edit it, in the same usergroup as the creator, teamlead, interaction-edit-elevated-rights) from validation against the entity state (in the past, closed, on hold).

Outside of the domain model, create an application service that drives the use case. It first checks the authorization (using entities or domain services) and then tries to perform the action (using entity or domain service). The domain model (typically the entity) checks the entity state and signals failure if the entity state doesn't allow the action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.