> I gathered the suggestions made by the people, put the relevant pieces
> from the current howto, added PEAR Coding standards and some
> suggestions of mine to a working draft for coding standards. Its far
> away from beeing perfect, but maybe a starting point for further
> discussion.
> 
> Interested people can download the draft (simple text-file) at
> http://www.holliwell.de/draft/draft.tar.gz; (it's about 3 kb)
> 
> or view online: http://www.holliwell.de/draft/draft

Nice. Some additions:

 - function naming: whether we use fooFunction() or foo_function()
   in functions defined in examples (if more than one word needed)
   I prefere the php form foo_function()

 - or die is good for development, but useless for production,
   use some user defined exit function instead on error

 - use ${varname} for complex vars in strings, $varname[x]
   will confuse readers, as this is illegal outside strings,
   concatenation makes code unreadable

 - do not use phpdoc (PEAR) comments, like @param

 - example email addresses, like [EMAIL PROTECTED]
   (someone pointed out the many junk mail coming
   to [EMAIL PROTECTED] and the like caused by an
   example on the mail function page)

 - For short example printouts, use a C++ style comment
   on the line where the output occurs, or the next line,
   where it is needed:

    echo $var; // outputs: 32

   In this case, using a separate <screen> would just
   clutter things...

 - Do not take advantage of register_globals, just in
   case you would like to present what register_globals
   means

 - If you use new vars (like $_ENV), always note that
   from when they are available, and what to use in older
   versions (always show newer and better examples too
   by the side of older ones)

 - Only use OOP features where you would like to
   present them, use simple functions in other areas,
   examples need to be clear and simple, but should
   show the possibilities and usage of the function[s]
   used

I may some up with more suggestions in the future, these
are the ones came to my mind reading your draft. Feel
free to discuss, and incorporate where appropriate.

Goba


Reply via email to