Separating content from how it is presented has been a mantra in the web world for well over a decade, and with the myriad of media now available for consuming content, the advantages of this are even more apparent. Web application developers long-ago adopted the Model-View-Controller (MVC) methodology from the software engineering world. Today nearly every website is data driven and incorporates user-defined interactions, and the MVC model is more important than ever in web development.
MVC and why it works
The MVC methodology is a form of layered architecture.- The Model is your data, how you manipulate it and how your data sets relate to each other and to your business logic;
- The View is exactly that – how the data is presented to (or viewed by) the user;
- The Controller is where the magic happens (and my favorite part)! The Controller is where your business logic resides – this is where decisions are made about how to act on the data. The Controller is the glue between your data and the view, as the controller not only manipulates the data, but also determines the appropriate view to return to the user.