Hello,

Due to my limited involvement in the ZF project, I don't feel comfortable with
hacking up your wiki page.  However, I would like to add a couple of comments:

1) Switch

  The construct "default" may never be omitted from a "switch" statement.

I don't think requiring an empty 'default: break;' is a good idea.  It will
give less-experienced developers an incorrect concept of how switches work. 
Better to add a note such as:

  NOTE: Remember to add a 'default' case to throw an Exception if the switch
value should have been caught be one of the cases.


2) If / Else / Elseif / Return

This rule is borrowed from the MySQL Coding Standards:

  If a 'return' statement is inside an 'if' block, then an 'else' block is not
necessary.

That is, instead of:

  if (...) {
    return true;
  } else {
    return false;
  }

You should use:

  if (...) {
    return true;
  }
  return false;

Unnecessary 'else' blocks make code very hard to understand.  This rule can
also be applied to 'throw', 'break' and 'continue' statements.


cheers,
Peter

  



--- Gavin Vess <[EMAIL PROTECTED]> wrote:

> As we are approaching 0.2, this might be a good time to revisit the 
> various changes to the ZF Coding Standard *draft* version in the wiki, 
> in order to help produce a version for release along with the other 
> docbook documentation.  We also have the beginnings of a separate "best 
> practices" section in our "Getting Started" wiki page, but those 
> practices are more abstract and thus more subjective in nature.
> 
> http://framework.zend.com/wiki/x/PQ
> 
> Cheers,
> Gavin
> 



                
____________________________________________________ 
On Yahoo!7
Check back weekly for  Trixi's new online adventures 
http://www.trixi.com.au

Reply via email to