| As the web evolves, so too is our concept of | | | | with new data to update parts of the webpage |
| MVC (model view controller) Architecture. As web | | | | without reloading the whole page. AJAX still wasn't |
| applications become increasingly complex and | | | | a perfect solution however, because every user |
| interactive, more and more logic is added to the | | | | interaction still had to make separate requests to |
| browser side of the application. As a result, web | | | | the web server. |
| applications are beginning to better simulate | | | | How is MVC Architecture implemented today? |
| desktop applications. These sorts of applications | | | | Once the web world began to embrace AJAX, a |
| are called RIAs (rich internet applications) and are | | | | new movement began to unfold called RIAs. With |
| going mainstream fast. Javascript is being pushed | | | | this model, the user could have a rich application |
| to its limits, and new RIA technologies like Flash 4 | | | | experience without making requests to the web |
| and Silverlight are slowly taking over the web. | | | | server with each action because the view |
| What's going on here? | | | | component of the MVC architecture resides in the |
| How was MVC Architecture implemented in the | | | | client (see the figure below) |
| past? | | | | New MVC Architecture Implementation: |
| In the past, all three components of MVC | | | | This is a big deal because it means that we are |
| Architecture, the model, view, and controller, | | | | rethinking how MVC architecture is implemented |
| resided on the web server (see the figure below). | | | | for web applications. |
| Old MVC Architecture Implementation: | | | | Here's an example. Let's say that you are using a |
| When a request was made to the web server, | | | | web application that displays data. You enter |
| the controller decided what page the user should | | | | some inputs, press "Enter", and the web |
| be directed too, what data to pull from the data | | | | application sends a request to the web server. |
| server, how to build the model, and how to build | | | | The controller then gets the appropriate data |
| the view. Once the view was created, HTML | | | | from the data server, creates a model of that |
| would then be generated and sent back to the | | | | data, and sends it back to the client via JSON. |
| client machine as a response. This was the fatal | | | | The client receives the JSON and replicates the |
| flaw of web applications in the past. Unlike | | | | model as native objects. If the user wants to see |
| desktop applications, if users needed to interact | | | | this data as a pie chart, the native model can be |
| with the interface, the application would have to | | | | used to generate a pie chart (which is a view) |
| reload the entire page, because all of the | | | | without making a request to the server. Likewise, |
| components of the MVC architecture were stuck | | | | if the user wants to see the data as a bar graph, |
| on the web server. | | | | the native model can be used to generate a bar |
| This is why AJAX was born in 1995. Ajax allowed | | | | graph, again without making a request to the |
| users to somewhat interact with a web | | | | server. All of this is done without reloading the |
| application's interface much better than before, | | | | page, and only one request was made to the |
| because individual requests could be made to the | | | | web server. |
| web server, which would then in turn respond | | | | Click here to read more about MVC. |