I dont understand why adding a TODOItem to the TODO list is not domain logic. #569
Replies: 1 comment
-
Indeed, i ended in this repo by some "Medium" accident and stumbled on this as well. Then I read Martin Fowlers "Anemic Domain Model" article again and was asking myself: Could it be that all these internet experts and efforts might not be correct in some ways? But now I begin to understand what it means to not be "religious" about architectural or technical approaches. If it fits it sits. So in this project it might be useful to do it this way. In my opinion it is a violation of the hexagonal architecture. Combining TodoItems with the TodoList is imho a task that should be done by one of these classes and not by some other outer dependency and definetly not by the application layer ("No business logic in application layer"). I will optimize my own code with some things i have learned so far with this and other repos, but will keep on things that suited best for me, like immutable objects, changes applied through methods that contain domain (business) logic and mapping models between layers. One other thing i really do not like about the approach in this repo is that the Commands are defined in the Application layer. In my opinion commands should be part of the domain because they contain logic on how domain objects are interacting with each other, which is imho again business logic that should be kept out of the application layer. I agree that handling a command (so calling an execute() method) is part of the application layer, but I think that there should be no other logic within there. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm looking at architectures and fell upon this repo, there is so much conflicting information out there and im really struggling to understand why things are done in certain ways.
Can i ask why the TODOList doesn't have some kind of method like AddTodoItem(TodoItem item) instead of relying on the application layer service to do this for us. Doesn't this make our domain model none OO and anemic?
Thanks,
Mark
Beta Was this translation helpful? Give feedback.
All reactions