MVC considered harmful20 Sep 2014
To better understand the historical context I think all web developers should be at least familiar with a basic description of the MVC pattern and familiar with the existing frameworks that are allready available.
A detour around Xerox PARC
Prior to the internet - programming mostly involved a workstation and in some cases a central server with a central datastore . Programming was mainly about data entry and computation and how share the results of that in a meaningfull manner. Great care and effort was put into meeting the immediate expectations of the users and programming was typically done using a structured plan - something that we know today as the waterfall model . Software modelling was (and still is) done by using metaphors to map user needs into software and carefully designing the sofware using object oriented constructs. One prevalent approach was to apply the MVC pattern invented by Trygve Reenskaug in 1978 while visiting Xerox PARC.
At the core of the MVC paradigm is :
- Model - Encapsulating the data and the domain logic
- View - Presenting data to the user
- Controller - Responsible for controlling the flow in the application and sending data back and forth between the model and the view.
Some of the most currently publicly visible projects are:
It should be noted that most of the listed frameworks now have implemented MVVM as an adaption of MVC. Microsoft introduced MVVM as an adaption of MVC to with considerations about the costs of exposing the entire model to the view. This was originally available via Silverlight and WPF and to some extent Adobe Flex - but has now been widely implemented by other frameworks.
One might argue that the average bravado of your average-day web hacker resembles that of a hired gun in the wild west. It is very easy to reach small
Eich in 10 days and contains shortcomings that has lead to use of linters
ruby on rails ) and jquery tried to address some of the shortcomings and disparaties in
Jokes aside ... It is important to understand that taking the MVC paradigm and applying it on web application programming in the same manner as you would have applied it to application programming in the PC era could be considered harmful. The web has a entirely different delivery mechanism than your local PC had.
Understanding the web as a delivery platform
The main difference between a local pc application and a web application today is typically that the web application involves data available from another machine. This should not pose a noticeable problem when rendering logic is expressed on the server - e.g when all the view is rendered via one call to the server. But if the view is constructed on the client side and requires several calls to fetch data e.g for a compound view then this could pose a problem performancewise. It should be immediately obvious that a solution where all data comes prerendered will be faster than a solution that requires data to be assembled via several calls. When you also consider the added complexity of tackling layout changes as a result of unpredictable results then you could start considering looking for ways to improve performance. So - one obvious choice would be to minimize the amount of needed calls to the server.
Where to go from here?
First of all - You should think very hard about what you are doing if you are planning to roll your own MVC framework. If you are going to do it anyway I hope you at least browse through the allready available frameworks and familiarize yourself with the basics of MV* and understand the performance penalties of cleanroom MVC.