Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dotting your i’s and crossing your t’s

Dotting your i’s and crossing your t’s

Presented on June 2nd 2016 at the GroningenPHP Meetup, Groningen, The Netherlands.
http://www.meetup.com/GroningenPHP/events/228763161/
---------------------------------------------------------------
Ever had to go back to code you did over a year ago ? And… did you like it ?
We all *love* well documented, testable, easily readable and understandable code. But how do you write it ? and what tools are available to help you ?
What can you do *now* to make your life and the life of your successor(s) and users easier ?
Learn how to avoid a build up of technical debt and make your good code awesome!
---------------------------------------------------------------

If you download the slides, the links should be clickable. Unfortunately they don't seem to be in the online deck, so here's a list of the links:

Slide 2:
Pluralsight: https://www.pluralsight.com/courses/regular-expressions-fundamentals

Slide 10
Technical debt in PHP projects: http://blog.insight.sensiolabs.com/2014/11/04/technical-debt-relevant-projects.html

Slide 11
Types of Technical Debt: http://www.martinfowler.com/bliki/TechnicalDebtQuadrant.html

Slide 12
How Quality affects software costs: http://www.sqgne.org/presentations/2010-11/Jones-Nov-2010.pdf

Slide 14
PHPUnderControl: http://phpundercontrol.org/
Sonar: http://www.sonarsource.com/

Slide 19
PSRs: http://www.php-fig.org/

Slide 20 - Debugging tools:
XDEBUG: http://xdebug.org/
PHP lint: http://www.icosaedro.it/phplint/
JS lint + hint: http://www.jslint.com/ , http://www.javascriptlint.com/ , http://www.jshint.com/
Firebug: http://getfirebug.com/
Profile: https://github.com/joehoyle/Time-Stack

Slide 21 - Educate yourself:
PHP manual: http://php.net/manual
PHP The Right Way: http://phptherightway.com/
ClearPHP: https://github.com/dseguy/clearPHP/blob/master/rules/README.md
phpcheatsheets.com: http://phpcheatsheets.com/
OWASP top 10: http://owasp.org/

Slide 28
PHP Code Sniffer: http://pear.php.net/package/PHP_CodeSniffer/
PHP CS-Fixer: http://cs.sensiolabs.org/

Slide 30
PHP cross-version compatibility ruleset for PHPCS: https://github.com/wimg/PHPCompatibility

Slide 38
PHPDocumentor: http://www.phpdoc.org/
PHPDox: http://phpdox.de/
ApiGen: http://www.apigen.org/

Slide 43
PHPUnit: http://phpunit.de/

Slide 45
Codeception: http://codeception.com/
Behat: http://behat.org/
PHPSpec: http://www.phpspec.net/
Selenium: http://docs.seleniumhq.org/

Slide 48
pDepend: http://pdepend.org/
PHPLOC: https://github.com/sebastianbergmann/phploc

Slide 49
PHP Mess Detector: http://phpmd.org/

Slide 50
PHP Copy Paste Detector: https://github.com/sebastianbergmann/phpcpd

Slide 51
PHP Dead Code Detector: https://github.com/sebastianbergmann/phpdcd

Slide 56
Git hooks: http://git-scm.com/docs/githooks.html and http://git-scm.com/book/en/Customizing-Git-Git-Hooks
Phing: http://www.phing.info/
Robo: http://robo.li/
GrumPHP: https://github.com/phpro/grumphp
Grunt: http://gruntjs.com/
Capistrano: http://capistranorb.com/
Gulp: http://gulpjs.com/

Slide 57:
Sonar: http://www.sonarsource.com/
Jenkins: http://jenkins-ci.org/
Travis: https://travis-ci.org/
Scrutinizer CI: http://scrutinizer-ci.com/
Circle CI: https://circleci.com/
PHP-CI: https://github.com/block8/phpci
Atlassian Bamboo: https://www.atlassian.com/software/bamboo
Exakat: http://www.exakat.io/online-demo/
Codeship: https://codeship.com/

Slide 62
Geek and Poke: http://geek-and-poke.com/
OSNews: http://osnews.com/comics

Slide 63:
Slides - well, you found them already ;-)
Feedback: https://joind.in/18322
Contact me: https://twitter.com/jrf_nl

More Decks by Juliette Reinders Folmer

Other Decks in Programming

Transcript

  1. Dotting Your I's and Crossing Your T's How to Make

    Good Code GREAT Juliette Reinders Folmer @jrf_nl
  2. #groningenPHP Who Am I? Self-employed, Independent Consultant Training Author at

    Pluralsight pluralsight.com Contributor to many open source projects
  3. #groningenPHP Potential defects Coding style Documentation Code coverage Code duplication

    Code complexity Unshared knowledge or code Unstable deployment process Outdated third party dependencies Technical Debt
  4. #groningenPHP Prevent Bugs  Apply best practices • APIs •

    Security • Avoid conflict • Lean & mean • Optimize • Apply PSR's
  5. #groningenPHP Prevent Bugs  Apply best practices  Use debugging

    tools • error_reporting() • XDEBUG • PHP lint • JS lint + hint • Firebug + extensions • Profile
  6. #groningenPHP Prevent Bugs  Apply best practices  Use debugging

    tools  Educate yourself • PHP manual • PHP The Right Way • Clear PHP • phpcheatsheets.com • OWASP top 10 • Conferences !
  7. #groningenPHP PHP Coding Standards PSR-1 PSR-2 PEAR Squiz Zend Framework

    Symphony Drupal WordPress TYPO3 Magento CakePHP FuelPHP ....
  8. #groningenPHP Documenting Your Code /** * Retrieve the (cached) file

    list for path. * * @param string $path * @param bool|null $recursive * @param string|array $allowed_extensions * * @return array|false File list array or false if an invalid path was provided */ public static function get_file_list( $path, $recursive = false, $allowed_extensions = null ) { }
  9. #groningenPHP Documenting Your Code /** * Retrieve the (cached) file

    list for path. * * @todo Check how optimized scandir() is and whether it would be useful to get a list * of all files first and only later filter for allowed extensions / subdirs. * * @since 0.5 * * @uses DirectoryWalker::$cache * @uses DirectoryWalker::validate_exts() * @uses DirectoryWalker::traverse_directory() * * @static * * @param string $path Path to directory. * @param bool|null $recursive Whether or not to walk subdirectories. * @param string|array $allowed_extensions Array of extensions to filter the files on. * * @return array|false File list array or false if an invalid path was provided */ public static function get_file_list( $path, $recursive = false, $allowed_extensions = null ) { }
  10. #groningenPHP  Git hooks  Phing  Robo  GrumPHP

     Grunt  Capistrano  Gulp ... etc...
  11. #groningenPHP  Sonar  Jenkins  Travis  Scrutinizer CI

     Circle CI  PHP-CI  Atlassian Bamboo  Exakat  Codeship ... etc...
  12. #groningenPHP Always code as if the guy who ends up

    maintaining your code will be a violent psychopath who knows where you live. - Martin Golding O’Reilly “ ”
  13. #groningenPHP Liked the Cartoons ? Also: the WTF Quality cartoon

    by Thom Holwerda – OSNews.com Geek and Poke is a creation of Oliver Widder Cartoons used with gracious CC permission Visit geek-and-poke.com for more !