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

Dotting your i's and crossing your t's - how to...

Dotting your i's and crossing your t's - how to make good code great

Presented on June 9th 2015 at the International PHP Conference, Berlin, Germany.
https://phpconference.com/2015se/en
---------------------------------------------------------------
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!

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 IPC Spring 2015 @jrf_nl
  2. #ipc15 Who am I? Self-employed independent consultant 15+ years in

    IT and web development Zend Certified Engineer PHPCheatsheets.com Contributor to LimeSurvey, phpBB, WordPress, AdoDB, ClearPHP and more
  3. #ipc15 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. #ipc15 Prevent Bugs Apply best practices • APIs • Security

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

    error_reporting() • XDEBUG • PHP lint • JS lint + hint • Firebug + extensions • Profile
  6. #ipc15 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. #ipc15 PHP Coding Standards PSR-1 PSR-2 PEAR Squiz Zend Framework

    Symphony Drupal WordPress TYPO3 Magento CakePHP FuelPHP ....
  8. #ipc15 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. #ipc15 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. #ipc15 Liked the cartoons ? Exception: 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 !
  11. #ipc15 Keep in touch! (I’m self-employed, you can hire me

    ;-) ) Juliette Reinders Folmer LinkedIn: http://nl.linkedin.com/in/julietterf Twitter: http://twitter.com/jrf_nl GitHub: http://github.com/jrfnl/ Slides will be posted to http://speakerdeck.com/jrf