I'm just starting to learn Drupal, and I am really liking it.
What are the most common pitfalls for a beginner? How can they be avoided?
First of all you should be clear with yourself on what you are trying to learn:
- Theming?
- Site building?
- Developing new modules/functionality?
Of course the boundaries of each of those areas are not sharp, but the patterns that you will follow to learn about drupal will be quite different. Here's my opinion:
General pitfall (applies to all areas)
The single most recurrent mistake beginners do is to be in a hurry. In a world of books with titles like "learn to master C++ in 24 hours or less" people approaches drupal believing that they can get away with a couple of days of playing around with somebody's else code. If they do not understand at first sight how things work in Drupal they switch to rant mode and begin to post on blogs and forums on how much drupal is stupidly complicated.
So: be prepared to invest time and energy to embrace the high level of complexity (which is something different than complication) of Drupal. Be prepared to actually study how things work rather than skim over help requests on forums and mailing lists. If you are still not convinced. Here it comes some good reading.
If you are learning about theming
- Pitfall: learning by trying to hack a previously existing theme.
- A better way: first off, give at least a good in-depth look at the Drupal theming guide. It's dry and it's boring but it gives you a good overview of the flow of the theming engine. Then download and install the zen theme and start you theme by using the starter kit that is included. I recommend - if you use Drupal 6 - to use the version 2 of the theme, although in beta, as it has a much more logical organisation of its internal files, at least IMO.
If you are learning about building sites
- Pitfall: getting overwhelmed by the amount of available modules and missing out on the big ones.
- A better way: read some of the case studies that have been presented over the years on drupal.org. You will get a pretty nice idea of what are common patterns in implementing functionality by means of contributed modules. Explore and understand the core components of drupal well. They are the basis for everything else, so you will definitively need to know how the mechanism of nodes and revision works, what is the functioning of the taxonomy, how the permission/roles system work, what are the differences between nodes and blocks etc... Do not miss out on CCK and Views, which - although they are (until now) contributed modules, are a component of 99% of the drupal sites "out there".
If you are learning about writing your own modules
- Pitfall: trying to put together a functionality by mean of assembling PHP and jQuery snippets of code retrieved here and there on the web.
- A better way of doing: if you want to be good at drupal you can't afford to go by the just in time learning paradigma, you have to go for the old-school just in case one. You really need to have a general overall understanding of all the components of the system (amongst others: form API, menu system, hook logic, js in Drupal, node processing, theming engine, localisation, caching...). Drupal is somehow a framework, and if you do not know well the ecosystem in which you are planting your code, chances are you will spent lot of time in producing an horrible code that will soon or later fail in doing what it is supposed to. Above all you will take a lot of time to code something that possibly would have taken a fraction of the time to be realised "the drupal way".
My opinion about possible tools for learning to code well in drupal
- http://drupal.org - Is packed with useful information, but it is so messy and the ratio signal/noise is so low that I would discourage to use the site as your main source of information.
- Books - IMO if you are new to Drupal it might be worth to invest on a couple of books. Books provide that logical structure and learning sequence that you can't have by jumping from one site to the other, following a screencast here and a how-to there. My top three: Module development is a book very well written, with a smart progression of topics, it actually guides you to writing a few modules with increasing complexity. It is a good reading to quickly get an idea of how drupal works. Pro Drupal Develpment is the book for Drupal. It is quite dry and - although it has examples of code all along - I like it more as a study-book / reference text. Be sure to get the second edition as the first one deals with Drupal 5, which is going to be obsolete soon. The only noticeable shortcoming of Pro Drupal Development is javascript (introduced in a very hasty way). JS and Drupal is a wide topic, and for that purpose I like Drupal 6 Javascript and jQuery better as the first book I mentioned, this book is also project-based (i.e. You learn things in relation to the needs to implement a project).
- Other websites - They are an invaluable source of information and examples. It is the perfect place to search when you have a general understanding on how to realise things, but too little experience in a specific domain to be autonomous (and everybody, no matter how experienced, have some domains in which they are not "pro"). Some good websites have been already mentioned by others. My all-time favourite is lullabot but drupal dojo and learn by the drop are also very good.
- Community - This is a huge asset of drupal. The community is very big and very helpful and you are likely to all the time find somebody wishing to help. The IRC channel is a good place to start.
- Meetings - Every 6 months the Drupal community meets for a few days (once in North America and once in Europe) to exchange expertise and information. Although travelling to DrupalCon can be (too) expensive for doing it, since a couple of meetings the community got organised to post all the videos of all the sessions held. They are an excellent resource too.
Hope this helps to get you going, and best luck with your learning! :)