MVC and its alternatives Flashcards

1
Q

What problem does MVC architecture come to solve?

A

Back in 1970 mixing responsibilities was between UI and business logic was a common “pattern”. MVC comes to solve that by promoting separation of concerns between backend and frontend.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In which context the original MVC pattern was created?

A

It was created in the context of desktop GUIs.

Other important concepts to know about the original MVC pattern is that:

  • The view uses the Model data objects directly, to show their data;
  • When the model data changes, it triggers an event that immediately updates the View (remember, in 1979 there was no HTTP);
  • Each view is, typically, associated to one controller;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does consist the Hierarchical Model-View-Controller (HMVC) ?

A

PAC, aka HMVC, provides for increased modularity in contexts of widgetization of sections of the UI.

Using HMVC, the controller that handles the main request will forward sub-requests to other controllers in order to get the renderization of the widgets and then incorporate it in the renderization of the main view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does consist the Model-View-Presenter?

A

The idea of this architecture is to further isolate the Model from the UI concerns:

The View is passive and unaware of model;

Focus on thin controllers (presenters) that contain no business logic and simply invokes commands and/or queries in the model, passing raw data to the View;

A change in data does not trigger an update in a view directly: it always goes through the presenter, which in turn updates the View.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does consits the Model-View-ViewModel?

A

The goal was to further segregate the UI design from the code and provide data binding from the View to the data model.

The ideas behind MVVM were:

One ViewModel corresponds to only one View and vice-versa;

Move view logic to the ViewModel to simplify the view; (Event handling, for example)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does consist the Model-View-Presenter-ViewModel?

A

This variant is more suitable for web development. The presenter receives an HTTP request, triggers a command or a query(Model), uses the data returned by the query, a ViewModel, a Template(View) and a template engine to generate the HTML and send it back to the client. All Views interaction goes through a Presenter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does consist the Resource-Method-Representation?

A

It is a MVC variant that tries to adapt the MVC pattern to the context of REST APIs. In this variant, each domain entity should have the public methods mappings to the http verbs. These methods are responsible for creating creating HTTP responses (Representation).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does consist the Action-Domain-Responder?

A

It is a MVC variant that tries to adapt the MVC pattern to the context of REST APIs. In this variant, differently From RMR, the domain (Model) in completely decoupled. The action (Controller) is responsible to access the domain and call a responder (View) to generate the HTTP Response.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly