Here at Advomatic our bread and butter are site planning, Drupal development, and Drupal hosting. We host many of the large Drupal sites that you the Drupal community have created. Along with that we have recently started offering a drupal maintenance service. We offer security upgrades and ongoing maintenance for the sites that we host. As part of that a few of our maintenance clients have asked us to fix issues with their sites or to build upon the tools that are already there.
There’s been a few times where I’ve had to apologize with something like “Unfortunately that took more time than we estimated because the code in question was not written in a maintainable fashion. No one anticipated that the code would ever need to be tweaked when they wrote it.”
This inspired me to start a blog series about Drupal maintainability and give some practical suggestions to build on Dylan’s post from last week on Zen and the Art of Drupal Maintenance. I’ve got several topics in mind and I hope to cover both the meta topics of how to approach coding in Drupal, as well as the more nitty-gritty code examples. My goal is one post per week. We’ll see how well I hold up.
Don’t hard-code something that is controllable in the admin UI
First up on the roster is something fairly simple, but easy to overlook, especially if you’re new to Drupal. Sometimes it’s easy to get in the zone, coding away on your latest theme or module. But it’s a good idea to take a step back and make sure that you’re not painting yourself into a corner.
The most common example that I see of this is with CCK labels. A client will come to me saying something like “I decided that the date didn’t really need a ‘date’ label so I went into CCK and turned it off, but nothing happened”. When approaching a design mockup it can be a good idea to start off in the Admin UI. Let Drupal do as much as possible for you. You can control the field order and what happens to the labels from within CCK.
Another area that I see of this is with ImageField and FileField. Both of these CCK fields give you the option to show the image/file or not. There’s also a lot of options for custom title and alt text. Let Drupal work for you, don’t work against it.
One of the ongoing memes in the Drupal community is to eliminate the webmaster / themer / developer / whoever-else-is-between-us-and-the-content. Of course this will never happen completely, we’ll always need people skilled at building websites. But the idea is to make websites easier to build, and easier to build in a way that’s maintainable, organized, extendable and performant.
What about you, are there other examples of things hard-coded that you frequently come across?