MVC or MVP everyone have heard those acronym at least once. But what they exactly stand for ?
MVC is Model View Controller and MVP is Model View Presenter. I can see some of you saying “what a scam” they changed one word and voilà. It’s a little more complex than this. Let’s start with some diagrams
As you can see, the communication between each entity isn’t identical. I will try to explain this difference.
MVC
The view
In the MVC design pattern, the view know the model and can display it.
The view listens the model an will be aware if it changes.
The controller
The controller knows the view and listens event from it.
The controller can modify the model without updating the view, because the view is a model listener.
MVP
The view
In the MVP design pattern, the view doesn’t know the model and receives basic orders to populate the interface (setLabelText, setTodayDate, but never read value from the model)
The presenter
The presenter knows the view, populates the view and binds itself to interface listeners
The presenter is the only entity to know the model and to listen it.