Chapter 3. Common Drupal Programming Mistakes

Experienced programmers have accumulated, through training or the experience of trial and error, a body of knowledge about how to approach problems and build applications. Unfortunately, some of this knowledge may lead them to make mistakes when they start working with Drupal, or to do things in less-than-optimal ways. This chapter covers several (somewhat overlapping) areas where programmers can shift their thinking or their approach in order to become more efficient at using the strengths of the Drupal platform, rather than fighting against it. Of course, following the principles in Chapter 2 will also help you shift your thinking to the Drupal way of doing things, and the suggestions and tools in Chapter 5 can help you avoid mistakes and find the mistakes that you do make.

Mistake: Programming Too Much

Experienced programmers who are new to Drupal often suffer from a variety of the “if all you have is a hammer, everything looks like a nail” syndrome: when faced with a challenge on a website (such as adding a feature or fixing a problem), they always try to solve it with programming. But although Drupal is built on PHP, and you can definitely do a lot of PHP programming when setting up a Drupal site, this is usually not the best approach: it results in a lot of unnecessary (and often tedious) programming. Related to this, experienced programmers coming to Drupal can be in a rush to become Drupal programmers, when really it would ...

Get Programmer's Guide to Drupal, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.