Code Standards » History » Version 8
Amber Herold, 03/05/2010 03:16 PM
| 1 | 1 | Amber Herold | h1. Code Standards |
|---|---|---|---|
| 2 | |||
| 3 | If everyone uses the same coding style, it is much easier to read code that someone else wrote. That said, style is not important enough to enforce during a code review. It is much more important to ensure that best practices are followed such as implementing error handling . |
||
| 4 | |||
| 5 | 2 | Amber Herold | h2. Python |
| 6 | |||
| 7 | 1 | Amber Herold | "Python Style Guide":http://www.python.org/dev/peps/pep-0008/ |
| 8 | 2 | Amber Herold | |
| 9 | h2. PHP |
||
| 10 | |||
| 11 | 3 | Amber Herold | This one is a bit old, but lots of good stuff that goes beyond style. Some things are questionable. I prefer Getters/Setters over Attributes as Objects (at least how the example shows it) to allow for better error handling. I prefer no underscores in naming except for constants that use all caps...but that is only a style issue. |
| 12 | 2 | Amber Herold | |
| 13 | "PHP Coding Standard":http://www.dagbladet.no/development/phpcodingstandard/ |
||
| 14 | 4 | Amber Herold | |
| 15 | From the Zend framework folks: |
||
| 16 | http://framework.zend.com/manual/en/coding-standard.html |
||
| 17 | 5 | Amber Herold | |
| 18 | An intro: |
||
| 19 | http://godbit.com/article/introduction-to-php-coding-standards |
||
| 20 | 6 | Amber Herold | |
| 21 | Nice Presentation: |
||
| 22 | 7 | Amber Herold | http://weierophinney.net/matthew/uploads/php_development_best_practices.pdf |
| 23 | |||
| 24 | 8 | Amber Herold | PHP Unit testing |
| 25 | 6 | Amber Herold | http://www.phpunit.de/pocket_guide/ |
| 26 | 7 | Amber Herold | |
| 27 | For automatically checking code against the Pear standards use CodeSniffer: |
||
| 28 | http://pear.php.net/package/PHP_CodeSniffer/ |