Becoming A Php Ninja

28
Becoming a PHP ninja Md. Emran Hasan [email protected]

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 of Becoming A Php Ninja

Page 1: Becoming A Php Ninja

Becoming a PHP ninjaMd. Emran Hasan

[email protected]

Page 2: Becoming A Php Ninja

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

Introduction

This presentation is about:

– development practices

– personal development

Page 4: Becoming A Php Ninja

DEVELOPMENT PRACTICES

Page 5: Becoming A Php Ninja

1. Coding standards

• Readable code

• Easy to maintain

• Documentation

Page 6: Becoming A Php Ninja

<?

// Method 1 if($condition)function1($a, $b, $c);if($i < 7 && $j > 8 || $k == 4)a($i);

?>

Page 7: Becoming A Php Ninja

<?php

// Method 2 if ($condition) {

getUser($id, $username, $key); }

If (($i < 7) && (($j < 8) || ($k == 4))) {

displayGraph($value); }

Page 8: Becoming A Php Ninja

• 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

2. Code Commenting

• Reduced code understanding time

• Serves as a documentation

• Answer the question: WHY??

Page 10: Becoming A Php Ninja

/**

* 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

3. Code re-use

• Re-use code across projects

• Refactor every now & then

• Don’t Repeat Yourself (DRY)

Page 12: Becoming A Php Ninja

4. Code testing

• Gives confidence

• Unit testing in rescue

• Test Driven Development (TDD)

Page 13: Becoming A Php Ninja

• PHPUnit - http://www.phpunit.de

• SimpleTest - http://www.simpletest.org

Page 14: Becoming A Php Ninja

5. PHP Framework

• Forces good structure

• Ready to use libraries

• Solves most real-life problems

80% - 20%

Page 15: Becoming A Php Ninja

• 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

6. Source Control (SCM)

• Your own personal UNDO

• Compare, rollback, track source code

• Must for team collaboration

Page 17: Becoming A Php Ninja

• Subversion - http://subversion.tigris.org

• Git - http://git-scm.com

Page 18: Becoming A Php Ninja

7. PHP IDE

• Increased productivity

• Reduced error in code

• Debugging, profiling

Page 19: Becoming A Php Ninja

• 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

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

PERSONAL DEVELOPMENT

Page 22: Becoming A Php Ninja

9. Being Communicative

• Increased productivity

• Reduces confusion

• Builds synergy in team

Page 23: Becoming A Php Ninja

10. Being Agile

• Working iteratively and incrementally

• Being responsible

• Being open minded

Page 24: Becoming A Php Ninja

11. Updating yourself

• Trying new technology

• Reading blogs

• Get updated through RSS

Page 25: Becoming A Php Ninja

• 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

12. Community involvement

• Starting to write blog

• Participate in forum and communities

• Contribute in open source projects

Page 27: Becoming A Php Ninja

Questions?

Page 28: Becoming A Php Ninja

Contact

+880 161 PHPFOUR

@phpfour

[email protected]

http://www.phpfour.com/blog