What is the legend about the arrows in these diagrams (MVC - MVP - MVVM)?

I am trying to understand the main differences between MVC / MVP and MVVM patterns. I found these 3 diagrams, but I'm not sure to understand them. Cool, you help me and explain to me what the legend of the dashed line and the continuous line is.

MVC from Wikipedia definition

MVC from Wikipedia definition

MVP from Microsoft MSDN

MVP from Microsoft MSDN website

MVVM from Microsoft MSDN

MVVM from Microsoft MSDN website

+7
source share
4 answers
  • Solid lines are direct calls.
  • Dotted lines are only event callbacks.

The main differences between MVC and MVP patterns (passive presentation):

  • The MVC view is aware of the model (calls to getData (), etc. to display data)
  • In MVP (passive view), the view is not aware of the model. The host transmits data from the model for viewing.

More details:

+7
source

I think the dotted lines are indirect links.

I am not so familiar with MVC or MVP, but in MVVM a View refers to a ViewModel , and ViewModel refers to a Model , which is represented by solid lines.

Models can broadcast messages or increase notifications about events that are picked up by ViewModel , and ViewModels can publish events that are selected by View , however, these objects should never directly refer to other objects, therefore they are indirect links. For example, a programmer knows that the purpose of raising an event notification on a Model is that the ViewModel can connect to the event and handle something, however the Model itself never refers to the ViewModel .

It should be noted that you are comparing templates, that they are very different templates that just use the same naming convention for some objects. For example, a Model in MVC does not match Model in MVVM. Instead, MVC M+C is equal to MVVM VM , and MVC M contains a combination of both MVVM M and VM pieces

+6
source

Dotted lines are notifications (for example, an observer pattern), and solid lines are direct knowledge (i.e. compilation of time dependencies). Data change notifications flow in dashed lines. A solid line with an arrow says that one component has knowledge of another and can directly push data. The dashed line is a looser link because the sender fires the event, but does not know the nature of the receiver of this event, which is hidden behind the event listener interface (if you are running event-driven versions of these templates).

The point of templates is to create order by avoiding spaghetti code, where everything interacts directly with everything else. Thus, diagrams are really just hints of what should be separated from what. Like any such diagrams, they are difficult to find without a detailed explanation, and they only really indicate what you should strive for; certain frameworks have more or less support for doing things in a "clean way." As components are loaded and connected together, they are not included in the scope of these diagrams; only what happens when the user enters data or the model is updated through another component of the view. Thus, actual classes can compile time dependencies and code to initialize objects that seem to break diagrams; however, while this is just an โ€œinitializationโ€ code that connects things together, it may not be material.

Here is a presentation that tries to explain MVP, MVC (or perhaps MVVMP) and MVVM (aka MVB) in terms of some less formal diagrams that show what compiles what and who notifies whom with event listeners of the observer pattern. This is relevant for your question, as it sets the context for what patterns they seek to achieve, which helps in interpreting the diagrams in your question:

Design Patterns in ZK: Java MVVM as Model-View-Binder, Simon Massey

Here's an article in which there are no diagrams, but which make the same simple screen three times using three different desktop templates controlled by a graphical interface (which can be freely described as MVP, MVVM, and MVC / MVVMP). One of the key points of confusion regarding M__ templates is that they are overloaded with nicknames and hardly describe the real picture. The article is relevant to your question as it follows Martin Fowlers' formal description of patterns that are more clear and less confusing than their names "M__":

Implement event driven graphical GUIs using the ZK Java AJAX platform, Simon Massey

While this article does not specifically answer your question, it gives a comparison of the three template implementations you are asking for and compares them; therefore, he will probably shed some light on choosing templates that should describe the diagrams. Of course, if you choose a different structure to implement the three templates, the example code will look different; but hopefully the same trade-offs will be considered as examples shown in this article.

+1
source

MVC is used in java architectures such as Spring, Struts, etc. MVC stands for model view and container.

very good to use this strategy in a web application

Model-view-controller (MVC) is a software architecture [1], which is currently considered as an architectural template used in software development. The template isolates the domain logic (application logic for the user) from the user interface (input and presentation), allowing independent development, testing and maintenance of each (separation of problems).

Using the MVC pattern leads to the separation of various aspects of the application (input logic, business logic, and user interface logic), while ensuring free communication between these elements. [2]

-one
source

All Articles