becoming a php ninja
DESCRIPTION
A few tips on how to go to the next level in PHP web application development. Tells about SCM, code convention, code testing, DRY, etc. Targeted towards the new PHPers who have worked for around 6-12 months.TRANSCRIPT
![Page 2: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/2.jpg)
About me
<about>
Doing PHP for 5+ years
Developer, consultant, manager
CTO, Right Brain Solution Ltd.
Previous: SWI, Pageflakes, Trippert Labs.
</about>
![Page 3: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/3.jpg)
Introduction
This presentation is about:
– development practices
– personal development
![Page 4: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/4.jpg)
DEVELOPMENT PRACTICES
![Page 5: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/5.jpg)
1. Coding standards
• Readable code
• Easy to maintain
• Documentation
![Page 6: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/6.jpg)
<?
// Method 1 if($condition)function1($a, $b, $c);if($i < 7 && $j > 8 || $k == 4)a($i);
?>
![Page 7: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/7.jpg)
<?php
// Method 2 if ($condition) {
getUser($id, $username, $key); }
If (($i < 7) && (($j < 8) || ($k == 4))) {
displayGraph($value); }
![Page 8: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/8.jpg)
• PEAR Coding Standardshttp://pear.php.net/manual/en/standards.php
• Zend Framework Coding Standardshttp://framework.zend.com/manual/en/coding-standard.html
• eZ Components Implementation guidelineshttp://www.ezcomponents.org/contributing/coding_standards
![Page 9: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/9.jpg)
2. Code Commenting
• Reduced code understanding time
• Serves as a documentation
• Answer the question: WHY??
![Page 10: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/10.jpg)
/**
* Add number
*
* This function will take two integer numbers and will
* return the addition result of them.
*
* @param int first number
* @param int second number
* @return int addition result
*/
function addNumbers($firstNum, $secondNum)
![Page 11: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/11.jpg)
3. Code re-use
• Re-use code across projects
• Refactor every now & then
• Don’t Repeat Yourself (DRY)
![Page 12: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/12.jpg)
4. Code testing
• Gives confidence
• Unit testing in rescue
• Test Driven Development (TDD)
![Page 13: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/13.jpg)
• PHPUnit - http://www.phpunit.de
• SimpleTest - http://www.simpletest.org
![Page 14: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/14.jpg)
5. PHP Framework
• Forces good structure
• Ready to use libraries
• Solves most real-life problems
80% - 20%
![Page 15: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/15.jpg)
• Zend Framework - http://framework.zend.com
• CodeIgniter - http://www.codeigniter.com
• CakePHP - http://cakephp.org/
• Symfony - http://www.symfony-project.org
![Page 16: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/16.jpg)
6. Source Control (SCM)
• Your own personal UNDO
• Compare, rollback, track source code
• Must for team collaboration
![Page 17: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/17.jpg)
• Subversion - http://subversion.tigris.org
• Git - http://git-scm.com
![Page 18: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/18.jpg)
7. PHP IDE
• Increased productivity
• Reduced error in code
• Debugging, profiling
![Page 19: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/19.jpg)
• Eclipse PDThttp://www.eclipse.org/pdt
• Netbeans IDEhttp://www.netbeans.org
• NuSphere PHPEdhttp://www.nusphere.com
• Zend Studio for Eclipsehttp://www.zend.com/en/products/studio
![Page 20: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/20.jpg)
8. Quality Code
Your PHP code should
– be simple
– get the job done
– be secure
– be scalable
– be maintainable
![Page 21: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/21.jpg)
PERSONAL DEVELOPMENT
![Page 22: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/22.jpg)
9. Being Communicative
• Increased productivity
• Reduces confusion
• Builds synergy in team
![Page 23: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/23.jpg)
10. Being Agile
• Working iteratively and incrementally
• Being responsible
• Being open minded
![Page 24: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/24.jpg)
11. Updating yourself
• Trying new technology
• Reading blogs
• Get updated through RSS
![Page 25: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/25.jpg)
• Planet PHP – http://planet-php.net
• PHPDeveloper – http://phpdeveloper.org
• Sitepoint – http://sitepoint.com
• PHP Classes – http://phpclasses.org
![Page 26: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/26.jpg)
12. Community involvement
• Starting to write blog
• Participate in forum and communities
• Contribute in open source projects
![Page 27: Becoming A Php Ninja](https://reader034.vdocuments.us/reader034/viewer/2022052410/555a4466d8b42ae1398b5066/html5/thumbnails/27.jpg)
Questions?