Hacker News new | ask | show | jobs
by narribbi 3338 days ago
When you read Trygve Reenskaug's original 1979 paper "MODELS - VIEWS - CONTROLLERS" -- it is very short, simple, and crystal-clear -- (http://heim.ifi.uio.no/~trygver/1979/mvc-2/1979-12-MVC.pdf), it obvious what Trygve meant:

* The MODEL is something like a web server

* The VIEW is something like a browser

* The CONTROLLER is something like the Windows start menu

Trygve literally writes:

"A view (=browser) is attached to its model (=server) and gets the data necessary for the presentation from the model by asking questions (=submitting queries). It may also update the model (=posting) by sending appropriate messages. A controller (=start menu) provides the user with input (=menu items) by arranging for relevant views (=windows) to present themselves in appropriate places on the screen."

6 comments

I feel this demonstrates why the MVC nomenclature is too vague and overloaded to be very useful any more. When every person has their own interpretation of the terms, they've lost meaning.

Case in point: to you, it seems obvious that the controller is like the Windows start menu. To me, that doesn't make any sense at all.

He literally writes these things but none of it really suggests your analogy. 'Controller = start menu' seems particularly iffy.
Taskbar might be more appropriate. Or even browser tabs, given he went with the browser.
Browser tabs are the same thing as a start menu conceptually.

Hardly the best example of an MVC controller (even if they still are controllers).

In common^W my sense, controller is a thing that rules the views in a non-data plane. E.g. in master-detail scheme someone has to switch detail datasets once user selects new master row. Controller is the one responsible, cause data has no knowledge of how it is presented — master-detail vs. tree-unfold vs. edit-dialog. Controller emerges from the fact that a single data item can be presented on many different forms with different behavior rules. The last sentence is pretty straightforward on that.
So, I would think in that case - in our sense :) - that the "C" would better be served by being called a "Coordinator" instead of "Controller".
Wow, thank you! That is enlightening. It makes me think of a Nintendo (model) plugged into a TV (view) with a controller (controller) plugged into the Nintendo.
Contoller is a toolbar I would say
It seems more like:

Model: JavaScript

View: HTML templates and css

Controller: Browser engine