This website uses cookies and saves data to create the best user experience. read more
Technology

MVC vs. CMS: Which one's right for you?

At Code-on we prefer model-view-controller (MVC) Web frameworks over content-management systems (CMS) but a CMS has its uses. Which one’s right for you?

What’s a Web Framework?

First, you might be asking: what’s a web framework? Just what it sounds like: software that supports the development of dynamic websites and Web applications. It’s code that’s like the people behind the scenes of a movie working the magic on screen while making it all seem fast, effortless and invisible. In other words, we coders work hard so you don’t have to, and when we do it right, you don’t notice it!

MVC

Back in the early days of the Web, developers had to manually change a site’s hypertext markup language every time they wanted to make a change to a page, which was both very limited and tedious. The next step was to write code where the user could make changes to a page: dynamic pages. A step up but still clunky and very slow as early servers had to process all those requests. So programmers kept trying — with attempted solutions such as servers (such as Apache) that either could handle the traffic or forward requests to servers that could handle dynamic code, and with new languages, such as PHP. Onno Timmerman, our co-founder, got started in PHP. After the advent of PHP, CMS seemed the solution for rapid development, resulting in Joomla, Drupal and WordPress.

However, eventually Web coders found the answer in frameworks that are whole software “stacks” of nimble, ready-to-use code that make dynamic sites and writing apps a snap for developers like us. Conceptually, sites and apps work best when the representation of the information is separated from user interaction, so the user’s end (what you see on your screen) doesn’t slow down or stop.

One such package is Django, written in the Python language and originating in the newspaper business. Onno was sold on it, switching completely to it in 2007, and we’ve been making great things with it ever since. Most frameworks, including ours with Django, uses the MVC model. The model is your data. The controller is the go-between for the user and the model, turning the user’s requests into commands the model can understand. A view is exactly what it sounds like: what you see on your screen after the model carries out your command. One thing that makes MVCs appealing to us coders is that we value using as little code as possible to do the job. In our business, “clean and simple” means fast and failproof. MVCs feature code reusability.

CMS

Then there are CMS frameworks. These computer programs let you publish, edit and modify your site’s content and do maintenance from a central interface. These are good for managing workflow in a collaborative environment. The difficulty with a CMS like Drupal is it’s hard to maintain and also hard to work in a team. But some CMS have been written to approximate what MVCs do.

Jumped-up CMS are fine for simple websites, and we’ll be happy to make one for you with Django CMS if that’s all you need. Simplicity is what Web developers strive for: it means things run fast and smooth. But if you have plans to expand your site on long-term basis, we recommend MVC instead. Our first choice is Django but you’re the boss: if you prefer another modern Python framework, just let us know.

wordpress-265132_1280.jpg
Wordpress interface

Comparison of CMS and MVC

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

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.
  • CMS; there’s no need to reinvent commonly used stuff such as breadcrumbs, easy media files, menu management, etc. With MVC you can easily add that stuff using a CMS based on Symfony.
  • CMS; Ready-to-use plugins vs. MVC; ready-to-use API libraries.

Customising: hard vs. easy!

  • CMS restricts what you can do; there are no restrictions with MVC.
  • Slow customising for unique requirements vs. quick customising.
  • 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.

The nirvana all coders strive for is to have the cleanest, simplest code getting the job done fast. To do that, we try to avoid redundant code clogging the system, slowing you down or worse, crashing. We in the business call this principle “Don’t Repeat Yourself” or DRY. By the way, Onno’s background is in philosophy, where this notion is called Occam’s razor. In our professional opinion, Django does this best. Lots of people are migrating from PHP to Python and Django. For jobs on the Web, big or small, Django’s way of doing MVC frameworks is the gold standard.