What is the difference between an MVC Model object, a domain object and a DTO

前端 未结 6 1483
遇见更好的自我
遇见更好的自我 2020-12-22 15:54

What is the difference between a MVC Model object, a domain object and a DTO?

My understanding is:

MVC Model object:

Models the data

6条回答
  •  失恋的感觉
    2020-12-22 16:21

    The Domain and DTO can also be your "model" objects - you can have a view to render the details of the "Customer" domain object.

    A domain object can have business logic to enforce the properties of the domain entity. validation is one such case. The domain object by itself does not contain persistence related methods, but it can have meta-data (like annotations) to support persistence

    the POJO programming model makes it possible to use the same object as your domain, DTO and model objects - essentially, you will not be implemented any extraneous interfaces that will only apply to one layer but does not apply to others.

提交回复
热议问题