Drupal Considered Awful

Posted Sun Dec 02 @ 03:01:09 PM PDT 2012

I had the privilege of using Drupal for the first time. It’s a PHP based content management system that tries to do everything, and fails miserably. As I read through the documentation I came across this little gem, Is Drupal the right tool for the job:

On the other hand, for certain limited uses, Drupal may not be the best choice:

  • If your only requirement is to write a personal blog…
  • …your only requirement is to create a wiki…
  • If your only requirement is to host discussion forums…

Yes, that’s right. They humbly suggest that if you’re building a blog, wiki, or forum, Drupal is the wrong choice. But Drupal is great for everything else! Not quite.

Caching

For whatever reason, Drupal is unbelievably slow right out of the box. To “solve” the problem, the geniuses working on Drupal decided to cache everything. And I mean everything. Yup, if you use Drupal to build your grandma’s baking store website, you need a cache just like the big boys. A quick look at my Drupal site reveals that I can flush the admin menu, cache tables, menu, class registry, page requisites, theme registry, and token registry caches.

What happens if you don’t cache? Simple pages take seconds to load. On my pretty powerful development machine, some pages would take upwards of 5 or 10 seconds to load when the cache was invalidated. That makes developing on Drupal so much more fun. You make a change, flush a cache, wait 5 or 10 seconds for the page to load, and then realize you flushed the wrong cache. Awesome!

hook_spaghetti()

Because Drupal wants to be good at everything (besides running a blog, wiki, or forum), they needed a way for braindead PHP developers to create “modules” on top of it. Inspired by the breathtaking minimalism and celebrated readability of the goto statement, the Drupal developers devised “the hook”. By creating a function with a certain name, your code will magically execute at some point during the page load (unless of course, it gets cached).

Drupal 7 only has about 350 hooks you need to know, so it’s pretty straightforward to memorize the order in which they get called and what they do. What’s more, every module you install can implement each hook too. So during a page load, the same hook might get called multiple times, and you never know in what order! Exciting!

Arrayly-Stringly Typed

Just about everything in Drupal is an array. Need a form? Make an array. Want to build a menu item? Make an array. Want to render a custom page? Array. Array. Array. Array. And by array, it is an array with numeric keys, or an associative array with string keys. Drupal don’t need no stinkin’ constants. Type safely is for those wimpy enterprise Java developers.

Tables

Drupal makes a new table for just about everything. For example, if you create a form with a first name, and a last name, Drupal creates (at least) two tables. One for the first name, and one for the last name. It sure makes your queries interesting.

<< Home