by Angie Byron on September 10, 2010 // Short URL

Drupal best practice: Document your way to understanding

Drupal is an ever-changing landscape, so it happens fairly often that you come upon a challenge you've never had to do before. Perhaps it's adding Views integration for a contributed module. Maybe it's trying to figure out how the heck to CCK works internally. Or possibly you've been tasked with adding recurring billing to an Ubercart store. These are all challenges I've run across in my day job and needed to figure out.

Whatever the challenge, you're going to have to dive in and figure out how some module or feature works. This usually is some combination of playing around and, when that fails, reading the documentation. And, because Drupal is a largely volunteer-driven open source community, you might find that documentation to be... sub-par (or even non-existent).

What to do? Well, here are some options...

The Loner

Spend the next several hours smashing your face into a wall figuring out how the darn thing works. Curse and spit at Drupal, at the module maintainer, at the world! Fix your problem, then move on with your life.

This "works", for some values of works. We've all been there. But it does nothing to improve the situation for the next poor schmuck who comes along and has to repeat the process. The community's collective hours spent on face-smashing tends to grow exponentially the more popular and less documented a project is. Everyone loses.

The Hater

Take your aforementioned cursing and spitting about the lack of documentation to an irate blog post or the developer's issue queue. Make sure they know how totally unacceptable the state of their documentation is and demand that they fix the situation.

This doesn't tend to go over well at all. Realize that from the module developer's standpoint, you're yelling at them about code that you just got for free and that they spent an enormous amount of their own personal (and in most cases unpaid) time on. You're likely to end up with a frowny face against you karma-wise which makes people far less willing to help you in the future. This is bad, especially in a project with as much "tribal knowledge" as Drupal.

The Doer

Write the documentation that's missing yourself, as you figure it out. You have to figure it out anyway, so why not? By writing it down for others, you both cement the knowledge in your head since you have to "teach" it, and you also do your Drupal karma good deed to help the next person not have to struggle as much as you did. And If karma isn't a powerful enough incentive, remember that the next person might be you again, six months from now. ;)

And often, module maintainers are willing to bend over backwards to help you if you're willing to help with documentation. It's win-win-win!

"But I don't know what I'm doing yet!"

Perfect! You are at exactly the right spot in your learning curve to write and fix documentation! Why? Because you know what someone in your shoes finds confusing!

If the module developer writes documentation, it's probably going to end up something like this:

Backreference Module provides a nodeapi interface to maintain 1-1 relationships between all shared instances of a nodereference field. This means that given a field instance of field_reference1, if you add a reference to NodeBeta to NodeAlpha's field_reference1 and NodeBeta has an instance of field_reference1, then NodeAlpha will be added to NodeBeta's instance of field_reference1.

If you write documentation, coming into this project fresh, it's probably going to end up something more like this:

BackReference module maintains one-to-one relationships between node reference fields.

For example, let's say you have two content types: Attendee and Event. Event has a node reference field called "Attendees" (field_attendees) that references Attendee types. When you click on an Event node, you'll see a list of the Attendee nodes that it references; this functionality is built into the core CCK Node Reference field.

BackReference module allows you to have the inverse, where clicking on an Attendee node will show you the Events they are attending.

If you're not sure about something, take a stab and label it with something like "TODO: Is this right?" Someone else can always come along after you and edit your docs to fill in the holes. But laying out the map of what holes need to be filled is something actually best achieved by people who don't understand how things work yet, because they know the right questions to ask.

Ok, fine. So where do I start?

Documentation usually comes in the following forms:

  • Basic documentation: Stuff like README.txt and INSTALL.txt that explain how to get the module up and running. These are generally improved by patches in the module's issue queue. Don't know how to patch? Just paste in some text into an issue. Lots of other people know how to make patches out of it. (http://drupal.org/patch has the full skinny if you're curious; it's a great skill to pick up!)
  • Handbook documentation: For more comprehensive documentation, often modules will have their own set of dedicated handbook pages. Look for a "View documentation" link on the project page. Almost all handbook pages can be edited by anyone with a Drupal.org account, so fill your boots! If there isn't already a handbook page, go ahead and browse around sections like the Administration guide or Site building guide and create a new page for the module in the most appropriate spot (if you don't know, just pick the closest match you can find; it can always be moved later).

    File an issue in the module's issue queue (or general Documentation queue for "meta" handbook pages) that indicates what you're working on and link over to your stuff for review.

  • API documentation: For programmers, it's really useful to have salient and relevant API documentation for a given project. The general convention on API docs is to create a project.api.php file that explains how the various hooks it exposes functions. If a module has one already, file a patch in the issue queue to clean it up. If not, create one and attach it to a new issue.
  • Crowd-sourcing: If you're working on some docs, make it a community affair! Hop on IRC / Twitter and announce to everyone that you're working on documentation for X, and see if you can wrangle a few other people to help using a real-time editor such as Etherpad. We did this the other week with Panels 3 documentation and it was a blast!

New to the drupal.org issue queue? Check out Addi's helpful issue queue tutorial video.

For more "real-time" help on where to put docs, how to use the issue queue, and so on, hop onto IRC: irc.freenode.net, channel #drupal-contribute.

New to IRC? Check out the docs on Drupal.org: http://drupal.org/irc

So let's do it!

So don't be a loner. Drupal has a huge community of people who absolutely love to help people who help others; there's no reason to go it alone!

And don't be a hater. In addition to making life generally miserable for those around you, this has real consequences for you when you find yourself in need of help later.

Instead, do it! Let's get out there and clean up some docs! :)

Angie Byron

Powered by Drupal!

Comments

abakkook

Thank you for this article.

Thank you for this article. I am new to Drupal and this helped me to feel that it is OK to help with the documentation even if I am no expert yet. I bet a lot feel this way. They are unsure of their technical abilities and don't want to intrude on those that do know more. This is good advise.

Reply

kitt

YES!

This is not only how I learned to write a module, but also how drupal.org received its first how-to-write-a-module tutorial, oh so way back when. \o/

I, also, am a big fan of the document to understand and share. Here's hoping others follow suit!

Reply

McGo

Great

It is so absolutely great to read through your posts, Angie. Thank your for pushing the good vibration into the Drupal world. It really needs that!

We will hopefully come with a bunch of new documentation out of our Drupal Sprint Camp in Hannover, Germany next month: http://sprint.undpaul.de

Reply

auzigog

Great Article

This is amazingly helpful, webchick! Thanks!

I definitely could've used this when I first started with Drupal a year ago.

This should become an often-linked-to item in IRC.

Reply

Pete

Good call

I've definitely fallen into the loner category a tonne of times and am another person who should have read this a year ago when i started. I'm definitely going to make the effort to kick start some documentation.

@abakkook - I still feel like I don't want to intrude on the experts...

great post.

Reply

angie

Funny thing about "experts"...

Here are a few observations, based on my experience in the Drupal community:

1. Experts certainly don't know everything. :) There is nobody out there, including Dries Buytaert himself, who knows everything about every facet of Drupal. Drupal people especially tend to go *very* deep on certain topics, and totally shallow on others because there is so much. Someone might be a complete Views genius, but if you sit them in front of Organic Groups, they throw up their hands in despair.

2. Collaborating with others who are knowledgeable in areas where we're weak is how stuff gets done in the Drupal project. A typical core patch is the culmination of work from several people; for example, someone skilled at designing APIs, someone skilled at doing front-end designs, someone skilled at English who can help explain how it works, and someone who has IE 6 installed (extremely valuable skill in an open source project, that!) who can help test it. In fact, even the smallest typo fix has to be reviewed by someone else.

The "experts" understand this collaboration model, and as a general rule welcome any and all help towards reaching the most optimal solution to a problem possible.

3. You know way more than you think you do. Sit back for a moment and consider the sites you've built with Drupal (or are in the process of trying to build with Drupal). You had to get the files on the web server somehow, and get a database set up. You had to successfully install Drupal. You had to evaluate, download, and configure modules to complete your objectives. You built content types and views. You probably had to do some theming, or at least download and evaluate various contrib themes to find ones that were useful to you. You maybe even cracked into some PHP. Or used some advanced tricks like Drush.

Now, consider that the person next to you might still be at the "What is FTP?" stage in their learning curve.

I can't emphasize this enough: if you have even once successfully installed Drupal, you are officially far enough along in your learning curve that you can help others. Pop by the support forums and answer a question or two. At best you'll feel really good about yourself and help a fellow Drupalista. At worst, you'll learn something new in your attempt to help out. :)

4. Let's also talk frankly about our definition of "expert" here. Who is really the expert at discovering what new users find confusing about the documentation? Is it the module developer, who wrote the thing, and has been using it extensively in projects for several years? Really? Or is it the person who's actively grappling with how to perform a task?

I think there's no question that the best expert to write documentation aimed towards new users is someone who still remembers what it was like to be a new user. :)

...

I have never once seen someone chastised for trying to improve documentation. Ever. That includes people who submitted documentation that had glaring mistakes, documentation with broken English, documentation that didn't conform to the documentation standards, and so on. Handbook pages have revisions. Version control systems have revisions. There is literally no possible way for you to screw something up so badly that we can't recover.

What I have seen though is the inverse: people who get their start in the Drupal community with documentation work skyrocketing their way up the "karma" ladder, getting huge praise and attention from grateful module maintainers, making friends and truly enjoying their time in the Drupal community. And having a lot fewer problems all around because of these relationships they form by becoming a Drupal contributor.

Do it! :D

Reply

chx

Dead on

I have struggled with field API and the moment I have pieced it together somewhat I immediately wrote the hand book I wish I had. That was half a year ago. I have no idea what I struggled with, it's trivial now :)

Reply

Cliff

Great post! Now let me make a suggestion...

The first thing the first morning of DIWD, it would be great to have a session for newbies on doing a local install. I feel like I'd be light years ahead of where I am now if I had only had a successful (!) Drupal installation going when I attended DIWD in 2008. In the presentation on CCK, for example, I could have gotten into the module in my own installation to better follow what Karen was doing and where she was doing it. And I could have taken screenshots along the way to remind myself what we had covered. And then I could repeat that in every other module-based session I attended.

And once everyone has their local installation going that first morning, give them this talk. (And then be sure to go through backup, delete, and restore. You know they'll need it!)

Talk about a welcome to the community -- it would be fantastic!

Reply

snufkin

\o/

Thanks for the heads up! Coincidentally I started self-documenting the Install Profile API for myself when I read this post, but thanks to this encouragement it is now available under the handbooks of drupal.org: http://drupal.org/node/908088

:)

Reply

Peter

You Rock..!

Yup. Help save a programmer, educator, web designer, business type... document and share. Drupal- I love you.

Reply

Joaquin Lippincott

Client documentation from service providers

Great article!

As a Drupal service provider there's also the need to create documentation for clients, to help make sure they have a great client experience with Drupal. A few things that we've played with include:

* Buying a book for your client (like Drupal 6 Content Administration)
* Creating customized screencasts which you can hand off to your clients of some basic tasks they are likely to need to repeat.
* Simplify the admin itself, by tailoring it to your clients needs (this one is probably the most critical, but it can be a hard sell for some people. It's best not to make it optional)

Reply

Nick Gonnella

Funny

This has to be one of the funniest blog posts I've read in a while. there's nothing like humour to help you get your point across and make it stick. Nick at The UK lingerie Company

Reply

Mike

I also

think i will be more Hater than Lover. Sometimes you like a thing and sometimes not... thats life ;)

Best regards Mike
from Friseur München

Reply

Pistachio Pony

What a relief

The reason I chose to learn Drupal is because of it's community. I wanted to feel like I wasn't alone while I learned and I wanted to be a part of open-source because open-source stuff makes me feel like the world is not so bad after all. Drupal has been a fun way to learn about aspects of web building that I did not know and every step has been challenging and thus very satisfying! It is a relief to know that I can and should share my experiences right away. I have really enjoyed posting on Drupal.org, it's true- it has helped me solidify what I learned. Like surgeons say- "see one, do one and teach one" is the best way to learn! Thanks for the article, you do rock!

Reply

Yannick

Yeah ;D

Cool post, I like it :)

Reply