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