View models provide a convenient object to pass to a rendering engine to create a html page. DTO’s are named for their common usage for shuttling data to and from a data store.
One of many reasons to use a view model is that view models provide a way to unit test certain presentation tasks such as handling user input, validating data, retrieving data for display, etc. Characteristics of DTO’s: • Are business objects – their definition is dependent on application data. • Primarily used for transporting data to and from a database.
Presentation models are often constructed for a single-use purpose such as to render a specific grid on a single page.
An example presentation model: View Models A view model is similar to a presentation model in that is a backing class for rendering a view.
For example dollar amounts may be represented as strings so they can contain commas and a currency symbol.
• Often defined by how they are used as well as their object characteristics.
Besides adding just the first and last names you might also want to add the department of the employee.It is something different than your View models differ from domain models in that view models only contain the data (represented by properties) that you want to use on your view.For example, lets say that you want to add a new employee record, your view model might look like this: are not needed in the view model.Usually, UI stands for User Interface which mainly comes under the human-interaction field.The main objective of UI Technology is to to make the user’s interaction as very simple and most efficient.
In other words, a simple DTO that is used as the backing model for rendering a grid is in fact also a presentation model in the context of that grid.