B-S-T Easy as 1-2-3
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 1,479 views

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

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

Statistics

Views

Total Views
1,479
Views on SlideShare
1,475
Embed Views
4

Actions

Likes
0
Downloads
3
Comments
0

2 Embeds 4

http://www.linkedin.com 3
http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

  • B-S-T easy as 1-2-3 Best Practices, Standards & Tools/Tips to make your life simpler Sunday, September 27, 2009
  • 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
  • Best Practices Sunday, September 27, 2009
  • 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
  • Sunday, September 27, 2009
  • 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
  • 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
  • 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
  • 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
  • Best Practices : Consider - How to benchmark the results - Have the knowledge in-house - Remember to innovate! Sunday, September 27, 2009
  • Best Practices : PHP - Unit testing - Source control - Documentation - Well-structured - Standardized Deployment - Integration tests - Design patterns - Benchmarking - Coding standards Sunday, September 27, 2009
  • Standards Sunday, September 27, 2009
  • 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
  • Standards : What - Not just about PHP. Think bigger. - Proven excellence - Regularly used by a certain group or project Sunday, September 27, 2009
  • Standards : What - Naming conventions - Variable definitions - Commenting styles (like DocBlock) - Use of external libraries - How things fit together Sunday, September 27, 2009
  • 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
  • Standards : Bad - Where’s the quality control? - Too strict? - Could stifle creativity - Poor implementation Sunday, September 27, 2009
  • 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
  • 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. Helpful hints and tips on their implementation Sunday, September 27, 2009
  • Tools & Tips Standards - PHP_CodeSniffer (PEAR) - Zend, PEAR, PHPCS, Squiz & MySource Sunday, September 27, 2009
  • 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
  • Tools & Tips Standards - PHP_CodeSniffer (PEAR) - Zend, PEAR, PHPCS, Squiz & MySource - Other Documentation source (like wiki/shared resource) Sunday, September 27, 2009
  • 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
  • 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
  • Tools & Tips Testing - PHPUnit phpunit.de - SimpleTest simpletest.org - Selenium seleniumhq.org - WebTest webtest.canoo.com Sunday, September 27, 2009
  • Tools & Tips Testing - PHPUnit phpunit.de - SimpleTest simpletest.org - Selenium seleniumhq.org - WebTest webtest.canoo.com - ab & siege joedog.org Sunday, September 27, 2009
  • Tools & Tips Deployment - Capistrano capify.org - Ant ant.apache.org - Phing phing.info Sunday, September 27, 2009
  • 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
  • Tools & Tips Deployment - Capistrano capify.org - Ant ant.apache.org - Phing phing.info - CruiseControl cruisecontrol.sourceforge.net - phpUnderControl phpundercontrol.org Sunday, September 27, 2009
  • Work Smarter Faster Better (best?) ...and don’t forget to share! Sunday, September 27, 2009
  • 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