SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Good Practice
in PHP
2
About Me
● Lorna Mitchell
● Twitter: @lornajane
● PHP consultant, trainer, and writer
● I live in Leeds
● Website: http://lornajane.net
3
Today's Outline
● Software Development Lifecycle
● Databases
● Source Control
● Documentation
● Open Source
4
Software Lifecycles
5
Waterfall
6
Waterfall
7
Agile
● Many different interpretations
● Some or all of:
● iterative
● customer involvement
● product is always working
● done in bursts called "sprints"
● spec can change (in a controlled way)
8
Extreme Programming
● Wildly fashionable a few years ago
● Useful ideas
● Pair programming
● Code for today (and refactor)
● TDD (Test Driven Development)
● Planning poker
● Acceptance tests
9
Databases
10
Databases
● Not a dumping ground
● Often your application bottleneck
● Worth understanding
11
Tools
● phpMyAdmin
● http://phpmyadmin.net
● Command Line
● powerful
● well-documented
12
Normalised Forms
● Guidelines for good table design
●
1st
Normal Form
● no repeating groups (e.g. comma separated lists)
●
2nd
Normal Form
● decouples entities and links them by relationship
(e.g. customer data separate from order)
●
3rd
Normal Form <- good enough!
● removes redundancy and dependent information
13
Indices
● MySQL uses indexes to quickly find things
● Foreign key contstraints
● Columns used in where clauses
14
EXPLAIN
● MySQL command
● Which indexes are used
● What kind of indexes
● Number of rows scanned
● Great for diagnosing slow queries
15
Source Control
16
Using Source Control
● Create a repository, add project
● Check out project
● Make changes
● Update to get other changes
● Commit changes to repo
17
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 lin
Added readme with outline
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
18
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
19
Source Control Tools
● Subversion (svn)
● http://subversion.apache.org/
● Git (git)
● http://git-scm.com/
● Bazaar (bzr)
● http://bazaar.canonical.com/
● Mercurial (hg)
● http://mercurial.selenic.com/
20
Accessing Source Control
● IDE Plugins
● Trac (http://trac.edgewall.org/)
● TortoiseSVN
● TortoiseGit
● TortoiseBzr
● TortoiseHg
21
Centralised Source Control
user
repo
user
user
user
22
Centralised Source Control
● Single repo (repository)
● Always commit to central
● Can branch centrally
23
Distributed Source Control
repo
repo
repo
repo
repo
24
Distributed Source Control
● Many repos
● Commit to local repo
● Share changes between anywhere
● No central point
25
What If I Don't Have Source
Control?
● Get some :)
● Install subversion
● Use a hosted solution
26
Documentation
27
API Docs
● Documentation generated from source code
itself
● Follows code structure
● classes
● inheritance
● methods
● parameters
28
PHPDocumentor
29
PHPDocumentor
● PHPDocumentor
● http://www.phpdoc.org/
● Uses reflection
● Comments for additional information
● Add descriptions to the documentation
30
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 }
31
Beyond API Docs
● Tutorials
● Installation instructions
● Examples
● FAQs
● Forums
● User-contributed
32
Today's Outline
● Software Development Lifecycle
● Databases
● Source Control
● Documentation
● Open Source
33
Other Topics
● System administration
● Maintenance and bugs
● Design patterns
34
Open Source
35
Open Source
● Free software
● Free as in beer
● Free as in freedom
● Licensing
● BSD
● GPL
● Avoid reinventing the wheel
36
Open Source
● You get what you give
● Participate!
37
The Local PHP Scene
● LeedsPHP http://leedsphp.org
● PHPNW http://phpnw.org.uk
● GeekUp http://geekup.org
38
Questions?
39
Good Luck
for your Future!

Weitere ähnliche Inhalte

Was ist angesagt?

Opensource pnp container based waf
Opensource pnp container based wafOpensource pnp container based waf
Opensource pnp container based wafVarun konadagadapa
 
The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...Krzysztof (Chris) Ozog
 
Last Month in PHP - February 2017
Last Month in PHP - February 2017Last Month in PHP - February 2017
Last Month in PHP - February 2017Eric Poe
 
DIve into the Open World - Presentation outline
DIve into the Open World - Presentation outline DIve into the Open World - Presentation outline
DIve into the Open World - Presentation outline R.Harish Navnit
 
Phpactor and VIM
Phpactor and VIMPhpactor and VIM
Phpactor and VIMdantleech
 
Using GIT for Everyone
Using GIT for EveryoneUsing GIT for Everyone
Using GIT for EveryoneGLC Networks
 
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...eMadrid network
 
Introduction to Open Source
Introduction to Open SourceIntroduction to Open Source
Introduction to Open SourceGluster.org
 
Responsibilities of gluster_maintainers
Responsibilities of gluster_maintainersResponsibilities of gluster_maintainers
Responsibilities of gluster_maintainersGluster.org
 
Third-party software management under BSD
Third-party software management under BSDThird-party software management under BSD
Third-party software management under BSDAndrew Pantyukhin
 
Version Control != Dependency Management
Version Control != Dependency ManagementVersion Control != Dependency Management
Version Control != Dependency ManagementPatrick van Dissel
 
Cache in Chromium: Disk Cache
Cache in Chromium: Disk CacheCache in Chromium: Disk Cache
Cache in Chromium: Disk CacheChang W. Doh
 
Clang compiler `
Clang compiler `Clang compiler `
Clang compiler `Rabin BK
 
Free and Open Source Sofware in the Herbarium
Free and Open Source Sofware  in the HerbariumFree and Open Source Sofware  in the Herbarium
Free and Open Source Sofware in the HerbariumVidyaratha Kissoon
 
ProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacementProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacementWei-Ning Huang
 

Was ist angesagt? (18)

Opensource pnp container based waf
Opensource pnp container based wafOpensource pnp container based waf
Opensource pnp container based waf
 
The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...
 
Last Month in PHP - February 2017
Last Month in PHP - February 2017Last Month in PHP - February 2017
Last Month in PHP - February 2017
 
DIve into the Open World - Presentation outline
DIve into the Open World - Presentation outline DIve into the Open World - Presentation outline
DIve into the Open World - Presentation outline
 
Phpactor and VIM
Phpactor and VIMPhpactor and VIM
Phpactor and VIM
 
Using GIT for Everyone
Using GIT for EveryoneUsing GIT for Everyone
Using GIT for Everyone
 
Python workshop
Python workshopPython workshop
Python workshop
 
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...
 
Introduction to Open Source
Introduction to Open SourceIntroduction to Open Source
Introduction to Open Source
 
Git back on_your_feet
Git back on_your_feetGit back on_your_feet
Git back on_your_feet
 
Responsibilities of gluster_maintainers
Responsibilities of gluster_maintainersResponsibilities of gluster_maintainers
Responsibilities of gluster_maintainers
 
Third-party software management under BSD
Third-party software management under BSDThird-party software management under BSD
Third-party software management under BSD
 
Version Control != Dependency Management
Version Control != Dependency ManagementVersion Control != Dependency Management
Version Control != Dependency Management
 
Cache in Chromium: Disk Cache
Cache in Chromium: Disk CacheCache in Chromium: Disk Cache
Cache in Chromium: Disk Cache
 
Clang compiler `
Clang compiler `Clang compiler `
Clang compiler `
 
Free and Open Source Sofware in the Herbarium
Free and Open Source Sofware  in the HerbariumFree and Open Source Sofware  in the Herbarium
Free and Open Source Sofware in the Herbarium
 
Script
ScriptScript
Script
 
ProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacementProjectTox: Free as in freedom Skype replacement
ProjectTox: Free as in freedom Skype replacement
 

Andere mochten auch

Profressional Development for Girl Geeks
Profressional Development for Girl GeeksProfressional Development for Girl Geeks
Profressional Development for Girl GeeksLorna Mitchell
 
What To Do If A Baby Is Choking
What To Do If A Baby Is ChokingWhat To Do If A Baby Is Choking
What To Do If A Baby Is ChokingTariq.N
 
Hybrid Approaches to Taxonomy and Folksonomy 11-20-09
Hybrid Approaches to Taxonomy and Folksonomy 11-20-09Hybrid Approaches to Taxonomy and Folksonomy 11-20-09
Hybrid Approaches to Taxonomy and Folksonomy 11-20-09Stephanie Lemieux
 
Working with web_services
Working with web_servicesWorking with web_services
Working with web_servicesLorna Mitchell
 

Andere mochten auch (6)

Mobile security
Mobile securityMobile security
Mobile security
 
Profressional Development for Girl Geeks
Profressional Development for Girl GeeksProfressional Development for Girl Geeks
Profressional Development for Girl Geeks
 
N6
N6N6
N6
 
What To Do If A Baby Is Choking
What To Do If A Baby Is ChokingWhat To Do If A Baby Is Choking
What To Do If A Baby Is Choking
 
Hybrid Approaches to Taxonomy and Folksonomy 11-20-09
Hybrid Approaches to Taxonomy and Folksonomy 11-20-09Hybrid Approaches to Taxonomy and Folksonomy 11-20-09
Hybrid Approaches to Taxonomy and Folksonomy 11-20-09
 
Working with web_services
Working with web_servicesWorking with web_services
Working with web_services
 

Ähnlich wie Goodpractice

Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)
Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)
Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)Per Henrik Lausten
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP StackLorna Mitchell
 
Python Linters at Scale.pdf
Python Linters at Scale.pdfPython Linters at Scale.pdf
Python Linters at Scale.pdfJimmy Lai
 
Doctrine Project
Doctrine ProjectDoctrine Project
Doctrine ProjectDaniel Lima
 
Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal DevelopmentChris Tankersley
 
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Giovanni Toraldo
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Fwdays
 
What's New in OpenLDAP
What's New in OpenLDAPWhat's New in OpenLDAP
What's New in OpenLDAPLDAPCon
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipsterJulien Dubois
 
Pentester++
Pentester++Pentester++
Pentester++CTruncer
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your NetworkCTruncer
 
Scaling Magento
Scaling MagentoScaling Magento
Scaling MagentoCopious
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Sam Becker
 
Chef - Administration for programmers
Chef - Administration for programmersChef - Administration for programmers
Chef - Administration for programmersmrsabo
 
Overview of Gitlab usage
Overview of Gitlab usageOverview of Gitlab usage
Overview of Gitlab usageOluDouglas
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020OdessaJS Conf
 

Ähnlich wie Goodpractice (20)

Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)
Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)
Source Control with Domino Designer 8.5.3 and Git (DanNotes, November 28, 2012)
 
Tool up your lamp stack
Tool up your lamp stackTool up your lamp stack
Tool up your lamp stack
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
 
Python Linters at Scale.pdf
Python Linters at Scale.pdfPython Linters at Scale.pdf
Python Linters at Scale.pdf
 
Doctrine Project
Doctrine ProjectDoctrine Project
Doctrine Project
 
Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal Development
 
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"
 
What's New in OpenLDAP
What's New in OpenLDAPWhat's New in OpenLDAP
What's New in OpenLDAP
 
Git In One Evening
Git In One EveningGit In One Evening
Git In One Evening
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
 
Pentester++
Pentester++Pentester++
Pentester++
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your Network
 
Scaling Magento
Scaling MagentoScaling Magento
Scaling Magento
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
 
Chef - Administration for programmers
Chef - Administration for programmersChef - Administration for programmers
Chef - Administration for programmers
 
Overview of Gitlab usage
Overview of Gitlab usageOverview of Gitlab usage
Overview of Gitlab usage
 
finall_(1).pptx
finall_(1).pptxfinall_(1).pptx
finall_(1).pptx
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
 
Open Source in Real Life
Open Source in Real LifeOpen Source in Real Life
Open Source in Real Life
 

Mehr von Lorna Mitchell

Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
Best Practice in API Design
Best Practice in API DesignBest Practice in API Design
Best Practice in API DesignLorna Mitchell
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open SourceLorna Mitchell
 
Business 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyBusiness 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyLorna Mitchell
 
Things I wish web graduates knew
Things I wish web graduates knewThings I wish web graduates knew
Things I wish web graduates knewLorna Mitchell
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Lorna Mitchell
 
Understanding Distributed Source Control
Understanding Distributed Source ControlUnderstanding Distributed Source Control
Understanding Distributed Source ControlLorna Mitchell
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service DesignLorna Mitchell
 
Coaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishCoaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishLorna Mitchell
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation TutorialLorna Mitchell
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHPLorna Mitchell
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHPLorna Mitchell
 
Could You Telecommute?
Could You Telecommute?Could You Telecommute?
Could You Telecommute?Lorna Mitchell
 

Mehr von Lorna Mitchell (20)

OAuth: Trust Issues
OAuth: Trust IssuesOAuth: Trust Issues
OAuth: Trust Issues
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
Best Practice in API Design
Best Practice in API DesignBest Practice in API Design
Best Practice in API Design
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open Source
 
Business 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyBusiness 101 for Developers: Time and Money
Business 101 for Developers: Time and Money
 
Things I wish web graduates knew
Things I wish web graduates knewThings I wish web graduates knew
Things I wish web graduates knew
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Join In With Joind.In
Join In With Joind.InJoin In With Joind.In
Join In With Joind.In
 
Going Freelance
Going FreelanceGoing Freelance
Going Freelance
 
Understanding Distributed Source Control
Understanding Distributed Source ControlUnderstanding Distributed Source Control
Understanding Distributed Source Control
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service Design
 
Coaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishCoaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To Fish
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHP
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
Example Presentation
Example PresentationExample Presentation
Example Presentation
 
Could You Telecommute?
Could You Telecommute?Could You Telecommute?
Could You Telecommute?
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 

Goodpractice