Saturday, 4 July, 2009 - 6:54pm (Sydney Australia)

All-natural web development

GreenAsh is a one-man show, based in Sydney Australia and run by Jeremy Epstein (Jaza). GreenAsh specialises in developing web sites that take care of themselves. Our favourite tool is an open source web Content Management System called Drupal, which we use to build sites that virtually anyone can update, and that your visitors can interact with.

GreenAsh contains no artificial preservatives (e.g. applets), no artificial sweeteners (e.g. Flash), and no artificial colours (e.g. ActiveX). It will not harm your unborn baby (like table-based layouts do). It is 100% clean and semantic, all-natural HTML, CSS, JavaScript and PHP. However, It may contain traces of [web developers who are slightly] nuts.

This site is where I write about the thoughts in my head, where I offer online resources, and where I advertise my skills and services.

Fresh thoughts

Hook soup

Of late, I seem to keep stumbling upon Drupal hooks that I've never heard of before. For example, I was just reading a blog post about what you can't modify in a _preprocess() function, when I saw mention of hook_theme_registry_alter(). What a mouthful. I ain't seen that one 'til now. Is it just me, or are new hooks popping up every second day in Drupal land? This got me wondering: exactly how many hooks are there in Drupal core right now? And by how much has this number changed over the past few Drupal versions? Since this information is conveniently available in the function lists on api.drupal.org, I decided to find out for myself. I counted the number of documented hook_foo() functions for Drupal core versions 4.7, 5, 6 and 7 (HEAD), and this is what I came up with (in pretty graph form):

Drupal hooks by core version

And those numbers again (in plain text form):

  • Drupal 4.7: 41
  • Drupal 5: 53
  • Drupal 6: 72
  • Drupal 7: 183

Aaaagggghhhh!!! Talk about an explosion — what we've got on our hands is nothing less than hook soup. The rate of growth of Drupal hooks is out of control. And that's not counting themable functions (and templates) and template preprocessor functions, which are the other "magically called" functions whose mechanics developers need to understand. And as for hooks defined by contrib modules — even were we only counting the "big players", such as Views — well, let's not even go there; it's really too massive to contemplate.

Filed in:

Also fresh:

Poll

Most-hated punctuation mark

Comma
17% (8 votes)
Semi-colon
42% (20 votes)
Exclamation mark
21% (10 votes)
Slash
10% (5 votes)
Brackets
10% (5 votes)
Total votes: 48