Wednesday, November 18, 2009


The purpose of this website is primarily to provide functional examples of the main classes and methods of the Zend Framework as training exercise. An example should not be considered as a proper tutorial but rather taken as commented code. Reading the manual and the API are prerequisites.

Also, the code of most examples does not comply with some coding standards as explained below.
  • Every example has everything in one file: PHP classes, HTML, JavaScript, and CSS. The example is then easier for the user to review, to download, and to play with. One file per example is also easier to maintain and to parse to generate a blog entry. In a real application environment, there would be separate files for each language and each class.
  • The Get method is used in almost all examples. This makes it easier for users to see what parameters are passed and to play with them outside of the form. In a real application environment, the Post method would be used in most examples.
  • Classes and methods are not commented with standard docblocs so the code remains lighter and easier to read. This should be acceptable because variable names are self-explanatory, or the same as those used in the API. Plus, the code is fully commented. In a real application environment, the docblocs would need to be filled properly.
  • Some functions receive a long list of arguments, other functions return a long list of parameters. This is for clarity in order to see easily what is passed. Some developers might choose to use arrays instead.
  • All exceptions are caught through the Exception base class. In a normal application environment, a separate catch block should be written for each specific exception.
  • The construct default in a switch statement is omitted where it adds no functional value.
  • Simple control statements based on the if/else constructs are often replaced with and/or statements.
  • Simple assignments are performed within if/else statements.
  • Type hinting is not done for function arguments.
  • Values of associative arrays are not aligned.
  • etc...

No comments:

Post a Comment