Tech Terms Explained Open in the app →

MVC

Architecture · Beginner · 4 min read

What is it?

MVC is a pattern that organizes an app into three parts: the Model (data), the View (display), and the Controller (logic that connects them).

Explain like I'm 5

MVC is like a restaurant: the kitchen stores and prepares food (Model), the plated dish you see is the View, and the waiter coordinating orders is the Controller.

Why was it created?

Mixing data, display, and logic in one place becomes a tangled mess. MVC was created to separate these concerns so code stays organized.

Where is it used?

  • Web application frameworks
  • Desktop and mobile UIs
  • Organizing app code
  • Separating display from logic

Why should developers care?

MVC underpins many web frameworks, so understanding it helps you navigate and structure real applications.

How does it work?

The Model manages data and rules; the View renders what the user sees; the Controller handles input, updates the Model, and selects the View. Keeping them separate makes each easier to change and test.

Real-world example

A web request hits a Controller, which loads data from the Model and passes it to a View that renders the HTML page.

Common use cases

  • Structuring web apps
  • Separating UI from logic
  • Organizing UI codebases
  • Making code testable

Advantages

  • Clear separation of concerns
  • Easier to maintain and test
  • Parallel work on UI and logic
  • Widely understood

Disadvantages

  • Can be overkill for tiny apps
  • Boundaries blur in practice
  • Controllers can grow bloated
  • Variants cause confusion

When should you use it?

When organizing an app with a user interface and meaningful logic.

When should you avoid it?

For trivial scripts or when a different architecture fits the app better.

Alternatives

MVVMMVPComponent-based architectures

Related terms

Design PatternsSOLIDMicroservices

Interview questions

Beginner

  • What do M, V, and C stand for?
  • Why separate them?

Intermediate

  • What goes in a controller versus a model?
  • How does MVC aid testing?

Senior

  • How do you keep controllers from becoming bloated?
  • How does MVC compare to MVVM?

Common misconceptions

  • "MVC is a framework" — it's a design pattern that many frameworks implement.
  • "Business logic belongs in the controller" — core logic usually belongs in the model layer, not the controller.

Fun facts

  • MVC stands for Model-View-Controller.
  • It originated in desktop UI work in the 1970s, long before web frameworks adopted it.

Timeline

  • 1970s — MVC pattern first described for UI software

Learning resources

Quick summary

MVC organizes an app into Model (data), View (display), and Controller (logic), separating concerns for cleaner, more testable code.

Cheat sheet

  • Model = data, View = display, Controller = logic
  • Separation of concerns
  • Common in web frameworks
  • Keep logic in the model

If you remember only one thing

MVC separates data, display, and logic so each can change and be tested independently.