Becoming A Php Ninja

Post on 19-May-2015

5222 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

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

Becoming a PHP ninjaMd. Emran Hasan

emran@rightbrainsolution.com

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?

Contact

+880 161 PHPFOUR

@phpfour

phpfour@gmail.com

http://www.phpfour.com/blog

top related