User1120430333 posted
Hi Friends,
I was wondering is a ViewModel synonymous with a Domain Model. If not then how do they differ. I was also wanting some clarity involving what is domain driven design.
Thanks !
IMO, a VM can be considered a domain model, since business rules can be applied to it via data annotations, and also, a model object in the Models folder in the MVC UI design pattern can act upon the VM with business rules. A VM can use other VM(s)
to complete the view that is used in MVC.
https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/overview/understanding-models-views-and-controllers-cs
<copied>
An MVC model contains all of your application logic that is not contained in a view or a controller. The model should contain all of your application business logic, validation logic, and database access logic.
<end>
DDD as I look at is about the complex core business needs of the application such as business rules and how objects in the domain interact with each other based on business needs, like purchase order domain object interacting with inventory domain
object that in turn interacts with the shipping domain object etc. and etc.
In a complex application based business needs, DDD is about how domains of business the application needs to interact with other to meet the needs required by a business requirement. The domains are identified and placed on a chart and actions
are implemented on the chart with code programming and unit testing to achieve the business requirement or need.