4 ms·
It is funny that MVC as a concept started as a backend server-rendered pages where the V was what rendered the HTML, C was the business logic which pulled data
by DanielHB 1y ago
It is funny that MVC as a concept started as a backend server-rendered pages where the V was what rendered the HTML, C was the business logic which pulled data from the M which was the database + adapters.
When bending it to apply to React + JSON-apis it kinda applies, but it is such a different approach that conceptually it is not relevant in the presence of a lot of client state.
- phil-martin 1y agoIt started waaaaay before backend server-rendered pages https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93con... "Trygve Reenskaug created MVC while working on Smalltalk-79 as a visiting scientist at the Xerox Palo Alto Research Center (PARC) in the late 1970s. He wanted a pattern that could be used to structure any program where users interact with a large, convoluted data set. His design initially had four parts: Model, view, thing, and editor. After discussing it with the other Smalltalk developers, he and the rest of the group settled on model, view, and controller instead."
- lelanthran 1y ago> It is funny that MVC as a concept started as a backend server-rendered pages where the V was what rendered the HTML, C was the business logic which pulled data from the M which was the database + adapters. I've got a CD from 1995 for Watcom C/C++. I purchased this compiler and IDE for a large (for me) sum of money and used it to create many Win32 applications. I recall that that the help pages (which were extensive) came along with some non-reference documentation, which gave a quick overview of MVC for writing Win3.1 and Win95 applications, so MVC was already well-known in GUI systems even back then.
- dsego 1y agoThe server-based MVC pattern adopted in Rails is not the original one described for use in interfaces, it could be considered a misinterpretation. https://andrzejonsoftware.blogspot.com/2011/09/rails-is-not-mvc.html https://andrzejonsoftware.blogspot.com/2011/09/rails-is-not-... https://news.ycombinator.com/item?id=3035549 https://news.ycombinator.com/item?id=3035549 A model is supposed to be a domain model, the business logic of the app, not simply a database access layer. Your logic should reside in the model layer, sort of like building a library of classes and functions that you can reuse. That's why in the server-side world people use the term "fat models" to describe this type of use. > When bending it to apply to React + JSON-apis it kinda applies There is no bending, the original MVC applied to separating the business logic from rendering views and capturing input events, because this separation promotes code reuse. You can write many different views and controllers in your UI that show and react to user's input but still talk to the same underlying logical model. I like this github repo to understand how MVC applies to programs with graphical interfaces. It's JS and HTML, so it's easy to follow. https://github.com/madhadron/mvc_for_the_web/tree/master https://github.com/madhadron/mvc_for_the_web/tree/master