Methods in Entity in DDD architecture

3

Could you help me with a question. In DDD architecture what types of methods should I put in my Entity and which ones should I in my Domain Service? I know that in my entity I should by at least the entity's own validation method, and when to the rest of the methods should I mandatorily in the domain service or are there other types of methods that I can by in the entity? Thank you.

    
asked by anonymous 22.10.2015 / 21:01

1 answer

2

There are several approaches and choices that vary with specific domains, but in DDD the idea is to make the entity as "rich" as possible.

This means that if you can put the method in a specific entity, and keep its attributes private, this is the best choice. That is, abuse the Object Orientation (encapsulation and cohesion).

A domain service should only be created when the business rule does not "fit" into one entity, having to use Public Properties of two or more entities.

    
22.10.2015 / 22:05