Drupal core... Look but don't hack (how to become a better Drupal developer in 5 steps)

By shane
Fri, 2011-06-17 14:29

Share with Others

The purpose of this post is to provide a little bit of guidance to those Drupal developers who maybe are just beginning, or are at least still in the overwhelmed learning stages. The first thing I want to say, is that learning Drupal (at least for me) was not something that I considered to be easy. I was not at all accustomed to the idea of using hooks so it initially took me some time to learn how to develop for Drupal the right way.

Make sure to also take a look at my 5 Secrets to Becoming a Drupal 7 Ninja Ebook if you are interested in Becoming a Better Drupal Developer. It contains a bunch of ideas and best practices that professional Drupal developers use to help them build and maintain Drupal websites.

Now lets get started.

1. Resources are everything

Before undertaking any major journey, it is important that you have the right tools. You wouldn't try to fix a car without a set of wrenches, you wouldn't try to run a large company without advisors, and you definitely wouldn't take a canoe downstream without a paddle. The point is, you need to know what you are getting yourself into and prepare a little in advance if you want to make sure you don't spin yourselves in circles or drive yourself crazy trying to learn how to build Drupal Modules.

Here are some things that you should do before really diving in to Drupal development:

  1. Make sure you have a development environment set up (LAMP/WAMP works nice, but there are other alternatives).
  2. Create an account on Drupal.org
  3. Determine if you want to start with Drupal 6 or Drupal 7 (this might depend on whether you are focusing on developing for existing sites, or building new sites).
  4. Start looking through this - http://drupal.org/developing/modules
  5. Bookmark http://api.drupal.org, you will probably need it

It is important that you also know where to go with questions. There are two places that I would recommend. The first is the #drupal or #drupal-support IRC channel (I am occasionally there as smthomas). This is probably the quickest way to get answers to your questions. However, I would recommend that you follow a few simple guidelines:

  • Don't ask to ask a question, just ask
  • Don't expect someone to be willing to discuss your questions for hours and then do it for you. Put in the research ahead of time and be willing to continue to do the work and research. We want to help, but not do things for you.
  • Make sure to say thanks... A little thank you goes a long way
  • After you become a Drupal ninja, make sure to pay it forward and help out others.

There may be more guidelines posted online somewhere but those are ones that I have heard/seen often. If you know anymore or have a link, feel free to drop it in the comments.

The other alternative for support would be the forums on Drupal.org. If you do post to the forums, make sure to follow up and let us know what solved your problem so others can benefit.

2. Finding the right balance

I find that good balance is important. I think it is a good idea to make sure you are comfortable building Drupal websites using core and contributed modules/themes from the Administration interface. This will ensure you can reuse existing modules as much as possible and don't have to rewrite the book every time you encounter a new problem. The process should almost always be to first search for an existing solution, and second to build your own. This will most likely save you the most time and make you as efficient as possible. This process also helps the quality of contributed modules get better over time.

Another important aspect to being a good developer is understanding a little about the theme layer and how theming works. This is especially important if you are building modules that themers will be using and designing websites for. This does not mean you need to be a theme designer yourself (I am far from a website designer), but it does mean you should understand the concepts. This will help you become a better overall Drupal developer.

3. Contrib is your friend

As mentioned before, use existing modules whenever possible. However, make sure to take that a step farther by actually looking through the contributed modules that you are using. This is one of the best and quickest ways to learn how to develop. Don't be afraid to modify the code of these contributed modules and see what happens on your development sites. If you can look through and understand some of what is going on with contributed modules, it will put you in a much better place to begin writing your own.

4. Drupal Core... Look but don't hack

One of the most important things you need to know when developing for Drupal is that you should not modify the core Drupal code. Drupal is designed to be very flexible and almost anything you need to do can be done through the use of module hooks or theme overrides. There are some very very very rare times when modifying the Drupal code is needed, but even then, there are usually alternatives (If you are just getting started with Drupal, you probably have not found one of those situations).

Just because you should not modify the core Drupal code, does not mean you should not look through some of it. Knowing how Drupal is structured and how certain pieces of functionality work is very important as you begin becoming a good Drupal developer. This may not be the place you start, but it is definitely something you want to consider doing as you gain more experience.

5. Get Involved

When you begin to refine your Drupal skills, you should consider contributing back. The easiest way is to help in the Drupal forums or IRC channels. You can also help with Drupal documentation or helping with developing/testing patches for contributed modules. By helping others you are not only giving back to people who are in the early stages of their learning, but you are also reinforcing your learning. I have learned a lot of things about Drupal just by helping others try to solve a problem.

Summing it up

Learning Drupal module development is a long, fun, never-ending journey that is definitely worth traveling. If you got this far, it's time to stop reading and start learning some Drupal.

Comments, suggestions, or questions? Leave a comment! If you are stuck on something and want some help, you can also use the contact form and I will see what I can do to help you out.