B-S-T
                             easy as
                               1-2-3
                             Best Practice...
What’s the Point?
                              Good development is good, but
                               better develo...
Best
  Practices
Sunday, September 27, 2009
Best Practices
                         A Best Practice is a technique, method, process, activity, incentive or reward
   ...
Sunday, September 27, 2009
Best Practices
                                                      (the best part)

                         By definiti...
Best Practices : What
                         - Not just about PHP. Think bigger.
                         - Best makes b...
Best Practices : Good
                         - Hit the ground running
                         - Helps you consider the ...
Best Practices : Bad
                         - Do more harm than good
                         - Understand! or don’t imp...
Best Practices : Consider
                         - How to benchmark the results
                         - Have the know...
Best Practices : PHP
            - Unit testing              - Source control
            - Documentation             - We...
Standards
Sunday, September 27, 2009
Standards
                         A technical standard is an established norm or requirement. It is usually a
           ...
Standards : What
                         - Not just about PHP. Think bigger.
                         - Proven excellence...
Standards : What
                         - Naming conventions
                         - Variable definitions
           ...
Standards : Good
                         - Levels the playing field
                         - Easier to get in on the ga...
Standards : Bad
                         - Where’s the quality control?
                         - Too strict?
           ...
Standards : Consider
                         - Will it work for your group?
                         - Does the team size...
Are they required for success?
                                     Hint: no.




Sunday, September 27, 2009
Tools &
Tips
Sunday, September 27, 2009
Tools & Tips
                         Tools you can use to help encourage, enforce, plan
                         out, etc...
Tools & Tips
                                           Standards

                         - PHP_CodeSniffer (PEAR)
     ...
Tools & Tips
                                            Standards
                              Example PHP_CodeSniffer O...
Tools & Tips
                                            Standards

                         - PHP_CodeSniffer (PEAR)
    ...
Tools & Tips
                                                       Testing
                                  - PHPUnit   ...
Tools & Tips
                                                       Testing
                                  - PHPUnit   ...
Tools & Tips
                                            Testing
                             - PHPUnit                php...
Tools & Tips
                                            Testing
                             - PHPUnit                php...
Tools & Tips
                                            Deployment
                             - Capistrano            c...
Tools & Tips
                                       Deployment - Phing
   <?xml version=”1.0”>
   <project name=”deploy_me...
Tools & Tips
                                               Deployment
                             - Capistrano          ...
Work
                                     Smarter
                                      Faster
                           ...
Thats It!
                                         Contact, Credits
                                            Chris Corn...
Upcoming SlideShare
Loading in...5
×

B-S-T Easy as 1-2-3

1,209

Published on

B-S-T Easy as 1-2-3 (CodeWorks '09)

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

  • Be the first to like this

No Downloads
Views
Total Views
1,209
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

B-S-T Easy as 1-2-3

  1. 1. B-S-T easy as 1-2-3 Best Practices, Standards & Tools/Tips to make your life simpler Sunday, September 27, 2009
  2. 2. What’s the Point? Good development is good, but better development kicks ass. If it can be done easier and better with less effort - why not? Sunday, September 27, 2009
  3. 3. Best Practices Sunday, September 27, 2009
  4. 4. Best Practices A Best Practice is a technique, method, process, activity, incentive or reward that is believed to be more effective at delivering a particular outcome than any other technique, method, process, etc. The idea is that with proper processes, checks, and testing, a desired outcome can be delivered with fewer problems and unforeseen complications. Best practices can also be defined as the most efficient (least amount of effort) and effective (best results) way of accomplishing a task, based on repeatable procedures that have proven themselves over time for large numbers of people.   Wikipedia: http://en.wikipedia.org/wiki/Best_practice Sunday, September 27, 2009
  5. 5. Sunday, September 27, 2009
  6. 6. Best Practices (the best part) By definition, best practices are what any group of developers and professionals have decided work best for any given situation. This means they’re opinions that have been confirmed by others, but it doesn’t mean that they’re law. Any developer can suggest a new practice at any time. Every developer has their own speciality. Find your niche and suggest away! Sunday, September 27, 2009
  7. 7. Best Practices : What - Not just about PHP. Think bigger. - Best makes better - Biggest bang for the buck - Defining them is hard (no, really) Sunday, September 27, 2009
  8. 8. Best Practices : Good - Hit the ground running - Helps you consider the important things - Defines a set of “rules” you can use - Keeps you current Sunday, September 27, 2009
  9. 9. Best Practices : Bad - Do more harm than good - Understand! or don’t implement - “Old wine in new bottles” - Best? or Just Good Enough? - Skip to the good parts - Consider the future Sunday, September 27, 2009
  10. 10. Best Practices : Consider - How to benchmark the results - Have the knowledge in-house - Remember to innovate! Sunday, September 27, 2009
  11. 11. Best Practices : PHP - Unit testing - Source control - Documentation - Well-structured - Standardized Deployment - Integration tests - Design patterns - Benchmarking - Coding standards Sunday, September 27, 2009
  12. 12. Standards Sunday, September 27, 2009
  13. 13. Standards A technical standard is an established norm or requirement. It is usually a formal document that establishes uniform engineering or technical criteria, methods, processes and practices. A technical standard may be developed privately or unilaterally, for example by a corporation, regulatory body, military, etc. Standards can also be developed by groups such as trade unions, and trade associations. Wikipedia: http://en.wikipedia.org/wiki/Standards Sunday, September 27, 2009
  14. 14. Standards : What - Not just about PHP. Think bigger. - Proven excellence - Regularly used by a certain group or project Sunday, September 27, 2009
  15. 15. Standards : What - Naming conventions - Variable definitions - Commenting styles (like DocBlock) - Use of external libraries - How things fit together Sunday, September 27, 2009
  16. 16. Standards : Good - Levels the playing field - Easier to get in on the game - Can reduce the small issues - Public standards make for easier integration Sunday, September 27, 2009
  17. 17. Standards : Bad - Where’s the quality control? - Too strict? - Could stifle creativity - Poor implementation Sunday, September 27, 2009
  18. 18. Standards : Consider - Will it work for your group? - Does the team size warrant the effort? - Will the team accept it? - Think wide, then narrow Sunday, September 27, 2009
  19. 19. Are they required for success? Hint: no. Sunday, September 27, 2009
  20. 20. Tools & Tips Sunday, September 27, 2009
  21. 21. Tools & Tips Tools you can use to help encourage, enforce, plan out, etc. Helpful hints and tips on their implementation Sunday, September 27, 2009
  22. 22. Tools & Tips Standards - PHP_CodeSniffer (PEAR) - Zend, PEAR, PHPCS, Squiz & MySource Sunday, September 27, 2009
  23. 23. Tools & Tips Standards Example PHP_CodeSniffer Output $ phpcs /path/to/code/myfile.php FILE: /path/to/code/myfile.php -------------------------------------------------------------------------------- FOUND 5 ERROR(S) AND 1 WARNING(S) AFFECTING 5 LINE(S) --------------------------------------------------------------------------------   2 | ERROR   | Missing file doc comment  20 | ERROR   | PHP keywords must be lowercase; expected "false" but found     |         | "FALSE"  47 | ERROR   | Line not indented correctly; expected 4 spaces but found 1  47 | WARNING | Equals sign not aligned with surrounding assignments  51 | ERROR   | Missing function doc comment  88 | ERROR   | Line not indented correctly; expected 9 spaces but found 6 -------------------------------------------------------------------------------- Sunday, September 27, 2009
  24. 24. Tools & Tips Standards - PHP_CodeSniffer (PEAR) - Zend, PEAR, PHPCS, Squiz & MySource - Other Documentation source (like wiki/shared resource) Sunday, September 27, 2009
  25. 25. Tools & Tips Testing - PHPUnit phpunit.de <?php class MySimpleClassTest extends PHPUnit_Framework_TestCase { private $_cvar = ‘test’; function testMyExample(){ $val=‘test’; $this->assertEquals($val,$this->_cvar); } } ?> Sunday, September 27, 2009
  26. 26. Tools & Tips Testing - PHPUnit phpunit.de - SimpleTest simpletest.org <?php class MySimpleClassTest extends UnitTestCase { private $_cvar = ‘test’; function testMyExample(){ $val=‘test’; $this->assertEqual($val,$this->_cvar); } } ?> Sunday, September 27, 2009
  27. 27. Tools & Tips Testing - PHPUnit phpunit.de - SimpleTest simpletest.org - Selenium seleniumhq.org - WebTest webtest.canoo.com Sunday, September 27, 2009
  28. 28. Tools & Tips Testing - PHPUnit phpunit.de - SimpleTest simpletest.org - Selenium seleniumhq.org - WebTest webtest.canoo.com - ab & siege joedog.org Sunday, September 27, 2009
  29. 29. Tools & Tips Deployment - Capistrano capify.org - Ant ant.apache.org - Phing phing.info Sunday, September 27, 2009
  30. 30. Tools & Tips Deployment - Phing <?xml version=”1.0”> <project name=”deploy_me” default=”main”> <property name=”version” value=”1.0” /> <target name=”unittest”> <phpunit> <batchtest> <fileset dir=”/www/mysite/tests”> <include name=”**/*Test*.php” /> </fileset> </batchtest> </phpunit> </target> <target name=”phpdoc” depends=”unittest”> <phpdoc title=”MySite Documentation” destdir=”/www/mysite/docs” output=”HTML:Smarty:PHP”> <fileset dir=”/www/mysite/docroot”> <include name=”**/*.php” /> </fileset> </phpdoc> </target> <target name=”lintme” depends=”phpdoc”> <phplint> <fileset dir=”/www/mysite/docroot”> <include name=”**/*.php” /> </fileset> </phplint> </target> <target name=”standardsplz” depends=”lintme”> <phpcodesniffer standard=”PEAR” format=”summary” file=”/www/mysite/docroot” allowedFileExtensions=”php php5 inc” /> </target> <target name=”main” depends=”standardsplz”> </target> </project> Sunday, September 27, 2009
  31. 31. Tools & Tips Deployment - Capistrano capify.org - Ant ant.apache.org - Phing phing.info - CruiseControl cruisecontrol.sourceforge.net - phpUnderControl phpundercontrol.org Sunday, September 27, 2009
  32. 32. Work Smarter Faster Better (best?) ...and don’t forget to share! Sunday, September 27, 2009
  33. 33. Thats It! Contact, Credits Chris Cornutt ccornutt@phpdeveloper.org @enygma @phpdeveloper @joindin @dallasphp http://DallasPHP.org Rate this talk at: http://joind.in/719 Photo Credits: easy button (Jason Gulledge) http://www.flickr.com/photos/ramdac/373881476/ red structure: struttura http://www.flickr.com/photos/cane_rosso/1748958423/sizes/o/ Dreaming of Diamonds (Swamibu) http://www.flickr.com/photos/swamibu/1182138940/ Sunday, September 27, 2009
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×