What is the difference between DTOs and ViewModels in DDD?

Technology CommunityCategory: Software ArchitectureWhat is the difference between DTOs and ViewModels in DDD?
VietMX Staff asked 3 years ago
  • The canonical definition of a DTO is the data shape of an object without any behavior. Generally DTOs are used to ship data from one layer to another layer across process boundries.
  • ViewModels are the model of the view. ViewModels typically are full or partial data from one or more objects (or DTOs) plus any additional members specific to the view’s behavior (methods that can be executed by the view, properties to indicate how toggle view elements etc…). In the MVVM pattern the ViewModel is used to isolate the Model from the View.