Domain Model
The domain model is a collection of classes without any presentation specific code. Just think of a pure list of customers. Also, one may add the buissnes logic into the domain model: code to modificate/change the model.
As Fowler describes:
The essence of a Presentation Model is of a fully self-contained class that represents all the data and behavior of the UI window, but without any of the controls used to render that UI on the screen. A view then simply projects the state of the presentation model onto the glass.
As you read, the domain model and the presentation model are completely different. If the domain is out list of customers we need a nice GUI to display this list. Here comes the presentation model and defines classes which contains the state of all elements in the GUI.
POJO (Plain-old-Java-Object)
A POJO is a class in Java which only extends Object
. nothing more.
class Foo { // this is a POJO
}
class Foo implements Bar { // this is also a POJO
}
class Foo extends Baz { // this is *not* a POJO
}
MVVM (Model-View-ViewModel)
The presentation model is slightly different from MVVM. The term model is the domain model. The view contains all GUI elements. The ViewModel only contains the correct representation of the data and includes a data binding. This pattern requires the use of any kind of binding whereas the presentation model does not. (Fowler said to have data binding but does not say in which class)
As we can read in this article MVVM comes after the presentation model and I think we should use MVPVM. in MVVM the ViewModel contains logic to present and logic to create the representation of the data which violates the Single-Responsibility-Principle. If we create a presenter and put the presentation logic into that class the violation is gone. So I think MVPVM is compatible with the SOLID-Design.