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

WordCamp Oslo 2018: How to Write Better Code Automatically

WordCamp Oslo 2018: How to Write Better Code Automatically

A revised version of my talk at WordCamp Rīga 2018.

Kaspars

March 03, 2018
Tweet

More Decks by Kaspars

Other Decks in Programming

Transcript

  1. “[..] he spent eight months automating all of the programming

    tasks. With all of his tasks fully automated by a computer, he was able to literally sit back and do whatever he wanted.”
  2. Use Computers to… Does it work with PHP 5.3 and

    PHP 7.2? Does it work with WordPress 5.0 and Jetpack 5.0? Does the JS & CSS work in IE 8? Deploy code automatically if tests pass.
  3. User Support Request “All images are broken in the latest

    version of the plugin! Fix it ASAP!111” 2. Use Version Control
  4. 3. Use Git Hooks $ git commit -m "Fix user

    not found" PHP Parse error: syntax error, unexpected '}', expecting ';' in modules/custom-post-types- taxonomies/module.php on line 27 Errors parsing modules/custom-post-types- taxonomies/module.php
  5. 7. Use Coding Standards Developers Who Use Spaces Make More

    Money Than Those Who Use Tabs https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
  6. 7. Use Coding Standards • Tabs or spaces for indentation?

    • Single or double quotes? • Closing PHP tags? • Braces or no braces for one-line conditionals?
  7. 10. Use a Virtual Environment Varying Vagrant Vagrants (VVV) https://varyingvagrantvagrants.org

    Good for WP core development Can’t run two boxes at the same time
  8. 1. Use a good text editor 2. Use Git for

    version control 3. Use Git hooks for automated checks 4. Use GitHub for continuous integration and accepting contributions 5. Use package managers 6. Use code linters 7. Use coding standards 8. Use .editorconfig 9. Use automated testing 10.Use virtual development environment
  9. Doug McIlroy
 Inventor of unix pipes and other wonders “As

    a programmer, it is your job to put yourself out of business. What you do today can be automated tomorrow.”