warning: Creating default object from empty value in /home/robloach/drupal/6/modules/taxonomy/ on line 33.

Unspoken Rules of Drupal

Many of you know some of the unspoken rules of Drupal. But, I have a feeling that I have to reiterate them once more for everyone:

1. Do not hack core
No matter how easy it seems to change one little file in Drupal's core file system to make it do what you want it to do, do not change it. Drupal is made so that the upgrade path is easy. It has been well thought out and designed so that there really isn't any reason to change or modify core in any way, shape, or form. Changing the file system means that you make upgrading to future versions of Drupal very difficult, meaning that you'll miss out on many security updates, bug fixes and will run into a maintenance nightmare later on. If what you're trying to do cannot be accomplished by what's there already, create an issue about your problem in the Drupal issue queue and maybe write a patch for it. Your feature will then become a part of Drupal core and you'll once again have that clean upgrade path. Do yourself and your fellow developers a favour and don't hack core.
2. Do not hack core!
This cannot be said enough.
3. Update to the latest Drupal
New versions of Drupal come with vital security fixes and bug fixes and will help protect your site from attacks. This doesn't necessarily mean update to Drupal 7 if you're on Drupal 6, just to update to the latest point fix of Drupal 6.  Also remember that older versions of Drupal will eventually stop being maintained as less people use and contribute back to it, so keep your upgrade path on the radar. Developers also love the updated APIs that come with newer versions of Drupal as they are much nicer to work with and allow much more flexibility.
4. Use contributed modules
Whatever you're trying to do with Drupal has probably already been attempted. Search around for a module that already exists that implements what you're looking for and use it. If it doesn't work how you'd like to it, stick a not in the project issue queue and fix what's wrong with it. The less custom code you produce means the less maintenance you'll have to do later on.
5. Uninstall before deleting modules
If you want to remove a module from your website, be sure to uninstall it from the modules page before deleting the module's folder. Wim Mostry brought this up after realizing that a client's site had a bunch of obsolete data and settings left over from older modules.
6. One module to ruin them all
If you're developing a custom module for a website, often times it seems like the best solution to stick all of your custom hooks and custom functions in one giant module. In reality, however, this custom module full of custom functions will eventually turn into one tangled mess of unmaintainable code. Do yourself a favour and group different sections of functionality if different modules. Creating distinctions in module functionality will allow you to easily turn off and on functionality instead of having to route through a horrible mess of code later on.
7. Develop with error reporting on
When developing a module, open up your php.ini, and set "error_reporting" to E_ALL. This will let you know about any small PHP warnings and notices you run into during development. The outcome will be nice, strict, clean code. On production sites, however, make sure to return it back to what it was so that users don't get confused if any big ugly red warnings/errors appear.
8. Contribute
If you make a changes to a contributed module for use on your own site, create an issue about it in the module's project queue outlining what you changed. Giving the module maintainer the chance to see how people are using their module will allow the module to adapt, evolve and grow.  Next time you use that module, you won't have to worry about making that change again because it will become part of the module's core functionality, as well as keeping the clean upgrade path.
9. Have Fun!
You're part of an amazing community of people with a large amount of awesome talent. Get involved with your local Drupal group, and get to know the people who are doing the same things as you and have fun!

If you know any other unspoken rules of Drupal, please let them be known!

Syndicate content