Please document code

joachim - July 24, 2009 - 15:12
Project:Webform Associate
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

> Improvements and patches accepted.

I am interested in this module, but I am having to spend a large amount of time understanding how the code works and what everything does -- this module involves by necessity a lot of altering and redirecting of other things, and as such that makes the code quite tangled.

Anyone else in my position is forced to do the same. That's a lot of coder hours.
On the other hand, I hope you still remember what the various functions do (if not... eek!)

What would help would be simple comments like function headers and things like this:

  // Redirect webform nodes to their associated node if one exists
  if ($node->type == 'webform' && $op == 'view') {
    $ids = webform_associate_lookup($node->nid, 'wid');
    if ($ids) {
      drupal_goto('node/'. $ids->nid);
    }
  }

This would help other people understand your module code more quickly, and make them more likely to pitch in with patches.

 
 

Drupal is a registered trademark of Dries Buytaert.