Descent into Drupal Madness
Having fairly recently been thrown into its orbit I thought I would note down my descent into madness the world of Drupal and how I am slowly coming around to a new way of thinking about this open source content management system.
Coming from a developer background filled with programming paradigms such as MVC design and OOP, delving into Drupal can be a bit of a daunting experience.
Now before you flame me down, it is my personal experience that has made me come to this conclusion. Procedural PHP was something I used to do when I was a kid and I have always looked forward to the fastest way to do things: new frameworks and ideologies to improve PHP such as CakePHP, Symfony and Joomla!Framework.
We have been actively increasing our Drupal exposure
At Manifesto we feel it is the most powerful and flexible open source PHP CMS on the market. So naturally I have been learning its ins and outs. Attending conferences such as DrupalCon in Prague and DrupalCamp in London, the more knowledge I gain about this system, the more I see how incredibly powerful it is.
This system lets you do just about anything you want, has commerce, has thousands of modules that extend the platform (for free) and, best of all, has a community of developers who are actively and willingly there to help for any use case.
It’s heavy but it packs a hell of a punch
Ok, we all know Drupal can be heavy and we all know that it can sometimes be a pain to configure (I have always said that the user interface and markup output by the system is built by developers for developers – see @mortendk‘s slides at this years DrupalCamp about the Drupal front end – very informative).
But therein lies the sheer power of the system.
I have been playing around with writing modules and getting stuck into the hooks system. The hooks system in Drupal is complex and brilliant. You can hook into any part of any system or any module (given they have hooks) which is great news as we all know some clients have very distinctive needs.
I don’t want to like Drupal, I really don’t, but for some reason I do!
It isn’t in my nature to write lines of code to do something a Model-View-Controller could do in a few lines but Drupal seems to have this magic way to just work when you need it to.
The flexibility of Drupal has allowed me to take some of the practices I have learned and apply it to my own modules.
For instance, I use the standard hooks system to pass information to a helper class that is written to reduce the calls Drupal has to make (storing variables for use in all hooks, instead of calling variable_get() in each hook which has a bigger overhead), where I can deal with it in the way I like (data can even be passed onto a framework such as Symfony or CakePHP and manipulated there), and the result is passed back.
This class means I can write succinct, reusable code without ending up with a module file that has thousands of lines of code.
Lovely!
Drupal will even register the class in the stack so you can access it easily.
The power that Drupal has, and the small crack in its defences that allow us to force through some more modern paradigms, is slowly shifting my view from other systems and frameworks to Drupal as a platform for well… everything.
It can do that.
Bring on Drupal 8!
Leave a reply