MVC on the Web

Started by sukishan, Jul 14, 2009, 05:13 PM

Previous topic - Next topic

sukishan

MVC on the Web
The ideas behind MVC frameworks are quite simple and extremely flexible. The idea is that you have a single controller (such as index.php) that controls the launch of applications within the framework based on arguments in the request. This usually includes, at a minimum, an argument defining which model to invoke, an event, and the usual GET arguments. From there the controller validates the request (authentication, valid model, request sanitization, etc.) and runs the requested event.

For instance, a request for /index.php?module=foo&event=bar might load a class called foo and run foo::bar(). The advantages of this method include:

* A single entry point for all applications.
* Removing the headaches involved with maintaining numerous scripts, each with their own relative paths, database connections, authentication, etc.
* Allowing the consolidation and reuse of code.
A good beginning makes a good ending