Pros and Cons of an MVC Framework

The web development community has been abuzz in recent years with using more and more frameworks and content management systems to build websites and web applications on. Frameworks using the MVC model, have been gaining a lot of popularity lately, but are they the best choice for your web project?

What is MVC?

MVC stands for Model ? View ? Controller. The idea is that your database information is contained in the Model, the data that controls how the data is displayed (I.e, the page itself) is in the view files. The controller files handle requests from the user, and help handle getting data from the model to the view, and vice versa. Some of the more popular MVC frameworks include Ruby on Rails and CakePHP.

For an example of how this works, we could look at Twitter, a popular social networking site that is built on Ruby on Rails. Whenever you look at any users profile, the url looks like this:

When you type this is in, it first calls the ‘users’ controller. The controller sees that you are trying to look at one particular member’s profile, so it queries the users model for information about that particular user. The controller then passes this information to a view file, which then constructs the page for that particular user.

The Pros of using an MVC Framework

The best part about using an MVC framework is that everything in the web application has a standard structure and it is compartmentalized. If you ever have any bugs that need fixing, they are very easy to track down. It’s also great if you ever need to update the code, as changing one piece won’t affect anything on the site. The MVC structure is also very handy for large scale projects that have several people working on them. The design department could be making the views while the programming department is working on the models, and nobody would be stepping on anybody’s toes.

The Cons of using an MVC Framework

One of the problems is that MVC frameworks can be incredibly bulky. They require a lot of files for everything to work properly. Ruby on Rails generates several files before you even enter your first line of code! Also, sometimes MVC applications can become compartmentalized to a fault. In addition to the models, views, and controllers, you can also have templates (sort of a global view), and helper files (which when there are complex views that can’t be handled by a typical controller). Now one web page could require up to 5 files just for it. If you are not careful, MVC projects can get out of hand pretty quickly. This can also end up affecting performance.


MVC encourages good coding practices and agile development. If your biggest concerns are how fast you can get things done and having a modular, easy to update and support site, than an MVC framework may be your best option. If you are more concerned about performance and keeping a less complex file structure, or if you are working a very large and complex project, than MVC may not be the right choice.

(Visited 1,516 times, 1 visits today)