DDD: Saving changes from UI to domain object

domain-driven-design

In many cases, there are different kind of forms in an application's user interface, and these forms are use to collect all the data – that is needed to update (or create of course) domain object (e.g. Person entity in Person Register application).

When the entire Person entity's data is transferred as DTO to backend softaware, so how to save the changes in DDD way? I have read several blog posts, where is guided that the every single way to change or fix data, should handle as an own business operation – such like changeAddress() or amplifyDescription(). But now I have all the changes in one DTO object, so what's next? Can I contemplate the DTO as a set of business operations and now I have to only transform those "commands" to real business operation calls? The fact is that it's quite usual that there are many operations put together in UIs and in some way, I have to handle it in backend.

I think that mapping dtos to domain objects using some kind of automapper or by hand, is wrong and anemic way to get things work, and it'd consist a lot of boilerplate and meaningless code.

Best Answer

You might want to have a look at the concept of Task-Based UI.

Under that paradigm, not only do the back-end layers reflect your domain processes, but the front end is also built with the end user's ultimate business goal in mind. There might not be a 1-to-1 mapping between user tasks and domain operations 100% of the time, but this is in any case a big help to force you to think outside the CRUD box including at the UI level.