I am reading Evans's Domain Driven Design. The book says that there are entity and there are services. If I were to implement an operation, how to decide whether I should add it as a method on an entity or do it in a service class?
e.g. myEntity.DoStuff()
or myService.DoStuffOn(myEntity)
?
Does it depend on whether other entities are involved? If it involves other entities, implement as service operation? But entities can have associations and can traverse it from there too right?
Does it depend on stateless or not? But service can also access entities' variable, right? Like in do stuff myService.DoStuffOn, it can have code like
if(myEntity.IsX) doSomething();
Which means that it will depend on the state?
Or does it depend on complexity? How do you define complex operations?