+ All Categories
Home > Technology > Developing better PHP projects

Developing better PHP projects

Date post: 18-Dec-2014
Category:
Upload: emran-hasan
View: 10,902 times
Download: 2 times
Share this document with a friend
Description:
A quick overview on project structure, development practices and use of tools to improve the overall quality of your PHP projects.
32
Developing better PHP projects Md Emran Hasan phpXperts seminar 2010 Nov 06, 2010
Transcript
Page 1: Developing better PHP projects

Developing better PHP projects

Md Emran Hasan

phpXperts seminar 2010Nov 06, 2010

Page 2: Developing better PHP projects

Who are you?

• Team / Project lead ?

• Development Manager ?

• Senior Developer ?

• Freelancer ?

Page 3: Developing better PHP projects
Page 4: Developing better PHP projects

Why you need this ?

• Better project organization

• Improved teamwork

• Adaptable to change

• Predictable and maintainable

Page 5: Developing better PHP projects

Elements

• Quality of code

• Project structure

• Development practices

• Use of tools

Page 6: Developing better PHP projects

Project Structure

Page 7: Developing better PHP projects

Common types

• Stand-alone

• Framework

• Hybrid

Page 8: Developing better PHP projects

Stand-alone

index.php

login.php

account.php

...

inc/

config.php

common.php

lib/

email_sender.php

alldb.php

xmlwriter.php

ezSql/

tcpdf/

Page 9: Developing better PHP projects

Stand-alone (cont’d)

• Separate files

• All variables are global

• Difficult to manage

• Almost no separation of concern

Page 10: Developing better PHP projects

Framework

library/

Zend/

application/

config/

application.ini

controllers/

Auth.php

Page.php

models/

User.php

Page.php

views/

script/

auth/

login.php

forgot.php

Page 11: Developing better PHP projects

Framework (cont’d)

• Built on top of Library Collection

• Applications extend from it

• Focuses on 20% of the 80-20 rule

Page 12: Developing better PHP projects

Hybrid

.htaccess

index.php

Pages/

Login.php

Account.php

Home.php

...

Models/

User.php

Page.php

Lib/

ezSQL/

Zend/

tcpdf/

Page 13: Developing better PHP projects

Hybrid (cont’d)

• Improved version of stand-alone

• Utilizes other Library Collection (Zend,

PEAR)

• Uses Front Controller approach

Page 14: Developing better PHP projects

Development Practices

Page 15: Developing better PHP projects

Planning

• Collaborate with customer

• Estimate team-wise

• Break total work into iterations

• Daily stand-up meeting

Page 16: Developing better PHP projects

Design

• Prefer simple design over complexity

• Adhere to a coding standard

• Avoid guessing by doing coding spike!

Page 17: Developing better PHP projects

Coding

• Write unit tests first

• Collective code ownership

• Optimize last

• Refactor mercilessly

Page 18: Developing better PHP projects

First make it work,

then make it right,

then make it fast.

- Kent Beck

Page 19: Developing better PHP projects

Use of tools

Page 20: Developing better PHP projects

Choosing tools

• Having a process helps choose tools

• Choosing Inappropriate tool can do harm

• Build a process if you don’t have any

Page 21: Developing better PHP projects

Type of tools

Release Management

Development Management

Product Management

Page 22: Developing better PHP projects

Product Management

• Should allow building requirements (use

cases, screen mockups, etc)

• Must be collaborative

• Must be shared among project members

Page 23: Developing better PHP projects

Development Management

• Need to allow multiple developers to work

together (version control)

• Need to keep codebase under control

(code review)

• Need to deal with bugs (issue tracking)

Page 24: Developing better PHP projects

Release Management

• Needs to allow setting project timeline

• Should allow scheduling of milestones

• Should measure development team velocity

Page 25: Developing better PHP projects

Suggestion for Newcomer

• Version Control: Subversion

• Issue/Feature Tracking: Spreadsheet (Excel,

Google Docs)

• Collaboration: Dropbox, Google Docs

• Communication: IM, Email, Meetings

Page 26: Developing better PHP projects

Suggestion for Intermediate

• Version Control: Subversion, Git/Mercurial

• Issue/Feature Tracking: trac, Mantis, Flyspray

• Collaboration: Wiki, Google Docs

• Code Review: Peer-to-peer review

• Communication: IM, Email, Meetings

Page 27: Developing better PHP projects

Suggestion for Experts

• Version Control: Git/Mercurial

• Integrated Project Management: JIRA, Redmine, Trac

• Collaboration: Wiki, Google Docs

• Code Review: Review Board, Crucible

• QA Automation: Selenium, Watir, phpUnit

• Continuos Integration: Hudson, CruiseControl

Page 28: Developing better PHP projects

Tips for picking right tool

• Tool that you can configure easily

• Tool that complements your process (does

not fight you)

• Tool that your team can adjust with easily

Page 29: Developing better PHP projects

Summary

Page 30: Developing better PHP projects

Take-aways

• Structure your project properly (use

framework if possible)

• Maintain good coding practice in team

• Use tools to increase team efficiency

Page 31: Developing better PHP projects

Questions?


Recommended