CMS or MVC?

Let’s put aside Front-End Frameworks for a while and look at MVC and CMS.

What is MVC?

MVC stands for Model View Controller. It’s definition can be splitted into this manner:

Models

Models represent knowledge. A model could be a single object, or it could be some structure of objects.

The Model’s job is to represent the problem domain, maintain state, and provide methods for accessing and mutating the state of the application.

Views

A view is a (visual) representation of its model. It would ordinarily highlight certain attributes of the model and suppress others. It is thus acting as a presentation filter.

The View’s job is to translate data into a visual rendering for response to the Client (ie. web browser or other consumer). The data will be supplied primarily by the Controller; however, the View may also have a helper that can retrieve data that is associated with the rendering and not necessarily with the current request.

Controllers

A controller is the link between a user and the system. It provides the user with input by arranging for relevant views to present themselves in appropriate places on the screen. It provides means for user output by presenting the user with menus or other means of giving commands and data. The controller receives such user output, translates it into the appropriate messages and pass these messages on to one or more of the views.

The essence of MVC can be depicted in this manner:

htmlcssbrowser2

M is the program, V is the design, and C is similar to what the user sees from his end of the browser.

What is CMS?

CMS stands for Content Management System. A content management system is software that keeps track of every piece of content on your Web site, much like your local public library keeps track of books and stores them. Content can be simple text, photos, music, video, documents, or just about anything you can think of. A major advantage of using a CMS is that it requires almost no technical skill or knowledge to manage. Since the CMS manages all your content, you don’t have to.

Examples of CMSes are WordPress, Blogger, Tumblr and Joomla!.

cms

So, say I’m going to make a website, which should I use?

Here’s a quick comparison of CMS vs. MVC and frameworks generally.

The basics:
• CMS gives you nice basic functionality; MVC gives you nice development tools.
• CMS is good for having many websites with typical functionality; MVC is good for a site with unique functionality.
• With CMS, there’s no need to reinvent commonly used stuff such as breadcrumbs, easy media files, menu management, etc. But with MVC you can easily add that stuff using a CMS based on Symfony.

Customising: hard vs. easy!
• CMS restricts what you can do; there are no restrictions with MVC.
• In CMS, changing the code can be hard and, worse, risky because you might lose compatibility with new versions of the CMS or other plugins. In MVC, doing this is easy, because the core doesn’t depend on the third-party solutions.
• CMS: unlike the core, modules and plugins can contain hard-to-fix bugs. With MVC, all the code is easy to control.

Checking and fixing code, the hard way or the easy way:
• With CMS it’s impossible to use good programming practices such as automated tests and refactoring. Not a problem with MVC.
• It’s also impossible to use coding standards to maintain code quality with CMS; they’re often used with MVC.
• With CMS, if a performance problem is in the core, you can’t fix it. With MVC, you can fix all performance issues.

Cost:
• CMS: expensive to set up and maintain. MVC: expensive to set up but not in the long run.

In conclusion, CMS are good for simple websites, when the site is not going to be running for a long time or if you do not require much designing. They are well-received if what you want is a ready-made application. However, if you have plans to expand your site in the long run, it might be better to go for MVC.

http://blog.codinghorror.com/understanding-model-view-controller/

http://www.sitepoint.com/5-most-popular-frontend-frameworks-compared/

http://code-on.eu/blog/choosing-mvc-or-cms/