As a developer, my introduction to Drupal was quite recent. I saw some strengths and flaws with it, as there are with all frameworks, but I couldn’t shake the strange feeling I had about it not employing Object Oriented (OO) programming. While searching for the reason behind this, I discovered that Drupal 8 does use OO. This is big news, and OO is just the beginning.
Symfony framework and MVC
Drupal 8 is written on the Symfony framework. To Drupal developers, that last sentence is a bombshell. The Symfony framework is a very popular Object Oriented MVC (model view controller) framework.
MVC frameworks have taken off in the last few years for a great number of reasons. Other big fish in the MVC arena include Zend, CakePHP, CodeIgnighter, Joomla, Ruby on Rails, Django, Angular and more. I found after graduating from Information Technology that if you didn’t know MVC, you weren’t employable as a web developer. While it’s a pain that MVC wasn’t a part of my education, I’m very happy that it’s so prevelent.
MVC is about a seperation of concerns. Software that has a user interface can be structured to seperate the database interactions from the logic of the application and from the look of the application (the front-end).
How MVC works
This seperation is represented by different types of “objects”, but also by a literal folder-based seperation. There’s a folder called “model” and others for “controllers” and “views”. Why is this so important? For the same reason that filing cabinets are important.
Imagine trying to run an archiving service. Everything you need to retrieve and modify is inside a filing cabinet. Familiarity with what files are where is a great asset to speed up tasks. Not everyone is familiar with this particular office though, and for those people, it’s of paramount importance to have some kind of convention. Alphabetized, numerical, whatever – just have a filing convention.
Previous versions of Drupal had their own convention for where files are and what they do, but it was a convention that was easily broken depending on what modules you installed and how developers configured the site. This meant as a Drupal site grew in complexity, having an understanding of why something looks or behaves a certain way became a full-time job, instead of actually getting tasks done.
By accepting several conventions that are bigger than Drupal itself, it’s as if Drupal has crawled out of it’s dank, albeit well-populated cave, and joined a larger, more organized, and more capable community. There are some downsides to a change this dramatic: modules for Drupal 7 will not be compatible with Drupal 8, and there will be a catch-up time before you can use your favorite modules with D8.
Because of this major change,the upgrade process might be a little bumpy–but the ride will definitely be worth it.