Speaking of code complexity…
I find that, in general, much of the PHP scripts/class code (this includes Pear code) that developers make available is overly complex, requiring a large time investment to actually make it useful. Which of course actually makes their code generally less useful in real world contexts. Oh Dave, your such a critic. “What should these developers do” you say?
If you have a complex set of scripts/classes/etc. here are the things I would want to help my ‘real world ramp-up time’ with your code:
- A High-Level Diagram: nothing elaborate, but I want to see from a higher level how your code fits in with its surroundings (PHP, databases, directories, servers, etc.). If your documents dump me right in at the branches-on-trees levels it will take me days of dinking with it to see the actual forest, days I spend in frustration (why the heck is this needed here?…, etc.), or not (often the case).
- At least one real world, detailed example: So many scripts/classes/etc. come with the most God awful, trivial, only-uses-one-aspect-of-the-code examples. These are just worthless. Period. Even when they are correct (which very often they aren’t because the code base changes at a 2.5x rate compared to documentation). Just one real example can negate reams of missing documentation, really.
- If the script/class is of a framework-ish or application structure-ish type I would like to have a small (empty) reference implementation to start with. This should be structured using the ‘best practices’ for your code. This will give me something to hang test code on and will get me up to speed in very short order (even if I don’t understand what I’m doing yet). Be sure to take into account other ‘best practices’ when you set this up (normal web server layouts, code references, etc.), and document those that you don’t adhere to.
- And in my dream world, I would like to see actual documentation. That is documentation that has actual text (not just the method/function definitions and their undocumented parameters) describing the inner-workings of your exquisite, hand-crafted code base. Even sprinkle on some working example code snippets.

