Repaso
EspaƱol
Design & PracticesIntermediateDP-50

What does the MVC pattern separate?

Options

  1. Model (data), View (screen) and Controller (input handling) (Correct option)
  2. Memory, Value and Cache, as the three layers of a program
  3. Main, Variable and Class, as the three parts of a file
  4. Method, Variable and Compiler, as the parts of a program

Answer

Model (data and rules), View (what the user sees), Controller (receives input and coordinates)

Why

MVC splits an application into:

  • Model: the data and business rules.
  • View: the presentation (HTML page, JSON).
  • Controller: handles the user's request, calls the model and chooses the response.

Spring MVC follows it: @Controller classes, services/entities as the model, Thymeleaf/JSON as the view. The goal: change the UI without touching the rules and vice versa.

Remember

MVC = model, view, controller separation.

Key terms

Practice this question in Repaso