Developing better PHP projects

12,964 views
12,923 views

Published on

A quick overview on project structure, development practices and use of tools to improve the overall quality of your PHP projects.

Published in: Technology
0 Comments
14 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
12,964
On SlideShare
0
From Embeds
0
Number of Embeds
4,894
Actions
Shares
0
Downloads
176
Comments
0
Likes
14
Embeds 0
No embeds

No notes for slide

Developing better PHP projects

  1. 1. Developing better PHP projects Md Emran Hasan phpXperts seminar 2010 Nov 06, 2010
  2. 2. Who are you? • Team / Project lead ? • Development Manager ? • Senior Developer ? • Freelancer ?
  3. 3. Why you need this ? • Better project organization • Improved teamwork • Adaptable to change • Predictable and maintainable
  4. 4. Elements • Quality of code • Project structure • Development practices • Use of tools
  5. 5. Project Structure
  6. 6. Common types • Stand-alone • Framework • Hybrid
  7. 7. Stand-alone index.php login.php account.php ... inc/ config.php common.php lib/ email_sender.php alldb.php xmlwriter.php ezSql/ tcpdf/
  8. 8. Stand-alone (cont’d) • Separate files • All variables are global • Difficult to manage • Almost no separation of concern
  9. 9. Framework library/ Zend/ application/ config/ application.ini controllers/ Auth.php Page.php models/ User.php Page.php views/ script/ auth/ login.php forgot.php
  10. 10. Framework (cont’d) • Built on top of Library Collection • Applications extend from it • Focuses on 20% of the 80-20 rule
  11. 11. Hybrid .htaccess index.php Pages/ Login.php Account.php Home.php ... Models/ User.php Page.php Lib/ ezSQL/ Zend/ tcpdf/
  12. 12. Hybrid (cont’d) • Improved version of stand-alone • Utilizes other Library Collection (Zend, PEAR) • Uses Front Controller approach
  13. 13. Development Practices
  14. 14. Planning • Collaborate with customer • Estimate team-wise • Break total work into iterations • Daily stand-up meeting
  15. 15. Design • Prefer simple design over complexity • Adhere to a coding standard • Avoid guessing by doing coding spike!
  16. 16. Coding • Write unit tests first • Collective code ownership • Optimize last • Refactor mercilessly
  17. 17. First make it work, then make it right, then make it fast. - Kent Beck
  18. 18. Use of tools
  19. 19. Choosing tools • Having a process helps choose tools • Choosing Inappropriate tool can do harm • Build a process if you don’t have any
  20. 20. Type of tools Release Management Development Management Product Management
  21. 21. Product Management • Should allow building requirements (use cases, screen mockups, etc) • Must be collaborative • Must be shared among project members
  22. 22. 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)
  23. 23. Release Management • Needs to allow setting project timeline • Should allow scheduling of milestones • Should measure development team velocity
  24. 24. Suggestion for Newcomer • Version Control: Subversion • Issue/FeatureTracking: Spreadsheet (Excel, Google Docs) • Collaboration: Dropbox, Google Docs • Communication: IM, Email, Meetings
  25. 25. Suggestion for Intermediate • Version Control: Subversion, Git/Mercurial • Issue/FeatureTracking: trac, Mantis, Flyspray • Collaboration: Wiki, Google Docs • Code Review: Peer-to-peer review • Communication: IM, Email, Meetings
  26. 26. 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
  27. 27. 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
  28. 28. Summary
  29. 29. Take-aways • Structure your project properly (use framework if possible) • Maintain good coding practice in team • Use tools to increase team efficiency
  30. 30. Questions?
  31. 31. References • Subversion • Git • Mercurial • Google Docs • Review Board • JIRA • Mantis • Basecamp • Redmine • Trac • Selenium • Watir • Hudson • Cruise Control • Flyspray • Dropbox

×