Becoming A Php Ninja
-
Upload
emran-hasan -
Category
Technology
-
view
5.223 -
download
4
description
Transcript of Becoming A Php Ninja
Becoming a PHP ninjaMd. Emran Hasan
About me
<about>
Doing PHP for 5+ years
Developer, consultant, manager
CTO, Right Brain Solution Ltd.
Previous: SWI, Pageflakes, Trippert Labs.
</about>
Introduction
This presentation is about:
– development practices
– personal development
DEVELOPMENT PRACTICES
1. Coding standards
• Readable code
• Easy to maintain
• Documentation
<?
// Method 1 if($condition)function1($a, $b, $c);if($i < 7 && $j > 8 || $k == 4)a($i);
?>
<?php
// Method 2 if ($condition) {
getUser($id, $username, $key); }
If (($i < 7) && (($j < 8) || ($k == 4))) {
displayGraph($value); }
• 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
2. Code Commenting
• Reduced code understanding time
• Serves as a documentation
• Answer the question: WHY??
/**
* 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)
3. Code re-use
• Re-use code across projects
• Refactor every now & then
• Don’t Repeat Yourself (DRY)
4. Code testing
• Gives confidence
• Unit testing in rescue
• Test Driven Development (TDD)
• PHPUnit - http://www.phpunit.de
• SimpleTest - http://www.simpletest.org
5. PHP Framework
• Forces good structure
• Ready to use libraries
• Solves most real-life problems
80% - 20%
• Zend Framework - http://framework.zend.com
• CodeIgniter - http://www.codeigniter.com
• CakePHP - http://cakephp.org/
• Symfony - http://www.symfony-project.org
6. Source Control (SCM)
• Your own personal UNDO
• Compare, rollback, track source code
• Must for team collaboration
• Subversion - http://subversion.tigris.org
• Git - http://git-scm.com
7. PHP IDE
• Increased productivity
• Reduced error in code
• Debugging, profiling
• 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
8. Quality Code
Your PHP code should
– be simple
– get the job done
– be secure
– be scalable
– be maintainable
PERSONAL DEVELOPMENT
9. Being Communicative
• Increased productivity
• Reduces confusion
• Builds synergy in team
10. Being Agile
• Working iteratively and incrementally
• Being responsible
• Being open minded
11. Updating yourself
• Trying new technology
• Reading blogs
• Get updated through RSS
• Planet PHP – http://planet-php.net
• PHPDeveloper – http://phpdeveloper.org
• Sitepoint – http://sitepoint.com
• PHP Classes – http://phpclasses.org
12. Community involvement
• Starting to write blog
• Participate in forum and communities
• Contribute in open source projects
Questions?