The First Law of Drupal: Don’t Write Code

By Deane Barker on January 25, 2010

The first rule of coding for Drupal : This is one of the things I’ve learned about Drupal over the last year, and the which I’ve struggled with more than any other.  My first inclination is always to write code.  But you’d be amazed how far you can get with Drupal without writing any code.

The consistent mistake that developers make is to plunge in with the intent of writing code. We do not write code. That’s a rule you should make with the expectation of breaking it, but with the intent of keeping it as much as you can.

If you’re a developer with any fluency in PHP/MySQL/HTML/CSS, this is a hard rule to face. If you’re new to Drupal and don’t understand the vast landscape of contributed modules and themes (design packages), it’s especially hard. You know your tools. You know how to get things done. So you reach for the comfortable and the familiar. Who minds if you’re reinventing the wheel? It seems faster to just do it your way.

With Drupal, writing code should be a very rare thing, to solve really bizarre problems.  Most of the common problems have already been sold and are configurable.



  1. It is true, there are a lot of modules. Download and use them. I think that modules like CCK, Views, Pathauto are essential and they should be integrated in the core of Drupal. Excuse me for my bad English, I am French and I am learning it.

  2. Yea. It certainly is a good idea to pull in 14 modules to get 90% of what you want. And spend hundreds of hours searching how to undo all the other features that came with these 14 modules.

    Then end up pulling in 5 more modules to undo the last features, links, buttons, workflows.

    And write one module to fill the gaps and get to the 90%.

    Or just write one, small, dedicated, focused module in the first place. Instead of carrying 20 poorly coupled modules along in an ever more complex project.

    As you see, I entirely disagree with your point that one should not write code. That said, Drupal is a poor development framework, so compared to other environments writing code does require a lot of work. So that small, dedicated, focused module may prove a lot more work then one would expect.

    But seen that you end up writing this code anyway, even if you re-use many modules, you could just as well start your project with writing it, instead of finding you have to write it when the deadline is looming.

Comments are closed. If you have something you really want to say, email and we‘ll get it added for you.