Your SlideShare is downloading. ×
0
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Things I wish web graduates knew
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Things I wish web graduates knew

2,554

Published on

Slides from a talk I gave to local students studying PHP, about some key skills, open source, and the importance of learning to help themselves.

Slides from a talk I gave to local students studying PHP, about some key skills, open source, and the importance of learning to help themselves.

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

No Downloads
Views
Total Views
2,554
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
42
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Good Practice in PHP Or "Things I Wish New Recruits Knew"
  • 2. About Me <ul><li>Lorna Mitchell
  • 3. Twitter: @lornajane
  • 4. PHP consultant, trainer, and author
  • 5. I live in Leeds
  • 6. Website: http://lornajane.net
  • 7. Book: http://sitepoint.com/books/phppro </li></ul>
  • 8. Today's Outline <ul><li>Software Development Lifecycle
  • 9. Databases
  • 10. Source Control
  • 11. Documentation
  • 12. Open Source </li></ul>
  • 13. Software Lifecycles
  • 14. Waterfall
  • 15. Waterfall
  • 16. Agile <ul><li>Many different interpretations
  • 17. Some or all of: </li><ul><li>iterative
  • 18. customer involvement
  • 19. product is always working
  • 20. done in bursts called &quot;sprints&quot;
  • 21. spec can change (in a controlled way) </li></ul></ul>
  • 22. Databases
  • 23. Databases <ul><li>Not a dumping ground
  • 24. Often your application bottleneck
  • 25. Worth understanding </li></ul>
  • 26. Tools <ul><li>phpMyAdmin </li><ul><li>http://phpmyadmin.net </li></ul><li>Command Line </li><ul><li>powerful
  • 27. well-documented </li></ul></ul>
  • 28. Normalised Forms <ul><li>Guidelines for good table design
  • 29. 1 st Normal Form </li><ul><li>no repeating groups (e.g. comma separated lists) </li></ul><li>2 nd Normal Form </li><ul><li>decouples entities and links them by relationship (e.g. customer data separate from order) </li></ul><li>3 rd Normal Form <- good enough! </li><ul><li>removes redundancy and dependent information </li></ul></ul>
  • 30. Indices <ul><li>An index allows MySQL to quickly find things
  • 31. Foreign key contstraints
  • 32. Columns used in where clauses </li></ul>
  • 33. EXPLAIN <ul><li>MySQL command
  • 34. Which indexes are used
  • 35. What kind of indexes
  • 36. Number of rows scanned
  • 37. Great for diagnosing slow queries </li></ul>
  • 38. Source Control
  • 39. Using Source Control <ul><li>Create a repository, add project
  • 40. Check out project
  • 41. Make changes
  • 42. Update to get other changes
  • 43. Commit changes to repo </li></ul>
  • 44. svn log ------------------------------------------------------------------------ r3 | lornajane | 2010-04-25 10:32:09 +0100 (Sun, 25 Apr 2010) | 1 line adding documentation notes ------------------------------------------------------------------------ r2 | lornajane | 2010-04-22 09:07:56 +0100 (Thu, 22 Apr 2010) | 1 line outlining source control and design patterns sections ------------------------------------------------------------------------ r1 | weierophinney | 2010-03-30 17:37:27 +0100 (Tue, 30 Mar 2010) | 1 line Added readme with outline ------------------------------------------------------------------------
  • 45. svn diff Index: README.txt =================================================================== --- README.txt (revision 3) +++ README.txt (revision 4) @@ -31,12 +35,20 @@ to share ideas to raise profile to be told you're doing it wrong! + (pulling up examples off our own blogs, if connection allows) Testing (Matthew) QA tools and CI including code analysis, mess detection, etc (Lorna - QA tools; Matthew - CI) + Static analysis + code sniffer + demo examples, find a suitable small codebase (joindin?) + mess detector + demo examples + what else? + Deployment
  • 46. Source Control Tools <ul><li>Subversion (svn) </li><ul><li>http://subversion.apache.org/ </li></ul><li>Git (git) </li><ul><li>http://git-scm.com/ </li></ul><li>Mercurial (hg) </li><ul><li>http://mercurial.selenic.com/ </li></ul></ul>
  • 47. Accessing Source Control <ul><li>IDE Plugins
  • 48. Trac ( http://trac.edgewall.org/ )
  • 49. TortoiseSVN </li><ul><li>TortoiseGit
  • 50. TortoiseBzr
  • 51. TortoiseHg </li></ul></ul>
  • 52. Centralised Source Control user repo user user user
  • 53. Centralised Source Control <ul><li>Single repo (repository)
  • 54. Always commit to central
  • 55. Can branch centrally </li></ul>
  • 56. Distributed Source Control repo repo repo repo repo
  • 57. Distributed Source Control <ul><li>Many repos
  • 58. Commit to local repo
  • 59. Share changes between anywhere
  • 60. No central point </li></ul>
  • 61. What If I Don't Have Source Control? <ul><li>Get some :)
  • 62. Install subversion
  • 63. Use a hosted solution </li></ul>
  • 64. Documentation
  • 65. API Docs <ul><li>Documentation generated from source code itself
  • 66. Follows code structure </li><ul><li>classes
  • 67. inheritance
  • 68. methods
  • 69. parameters </li></ul></ul>
  • 70. PHPDocumentor
  • 71. PHPDocumentor <ul><li>PHPDocumentor </li><ul><li>http://www.phpdoc.org/ </li></ul><li>Uses reflection
  • 72. Comments for additional information
  • 73. Add descriptions to the documentation </li></ul>
  • 74. PHPDocumentor Comments 1 < ?php 2 3 class AttendeeList { 4 private $attendees ; 5 private $observers ; 6 7 /** 8 * Add an attendee to the list 9 * 10 * @param integer $id Attendee identifier/array index 11 * @param string $name Full name of the attendee 12 * @access public 13 * @return boolean If attendee was successfully added 14 */ 15 public function addAttendee ( $id , $name ) { 16 $this -> attendees [ $id ] = $name ; 17 $this -> notify (); 18 } 19 20 }
  • 75. Beyond API Docs <ul><li>Tutorials
  • 76. Installation instructions
  • 77. Examples
  • 78. FAQs
  • 79. Forums
  • 80. User-contributed </li></ul>
  • 81. Today's Outline <ul><li>Software Development Lifecycle
  • 82. Databases
  • 83. Source Control
  • 84. Documentation
  • 85. Open Source </li></ul>
  • 86. Other Topics <ul><li>System administration
  • 87. Maintenance and bugs
  • 88. Design patterns </li></ul>
  • 89. Open Source
  • 90. Open Source <ul><li>Free software </li><ul><li>Free as in beer
  • 91. Free as in freedom </li></ul><li>Licensing </li><ul><li>BSD
  • 92. GPL </li></ul><li>Avoid reinventing the wheel </li></ul>
  • 93. Open Source <ul><li>Find excellent (free) tools
  • 94. Build excellent (free) tools </li></ul>
  • 95. The Local PHP Scene <ul><li>LeedsPHP http://leedsphp.org
  • 96. PHPNW http://phpnw.org.uk
  • 97. GeekUp http://geekup.org </li></ul>
  • 98. The Global PHP Scene <ul><li>Everything happens on IRC </li><ul><li>try #phpc or #phpnw for starters </li></ul><li>Read http://phpdeveloper.org daily
  • 99. Check out http://stackoverflow.com
  • 100. Learn to help yourself! </li></ul>
  • 101. Questions?

×