• Notepad++ (Windows)
• Dreamweaver (Mac / Windows)
• Sublime Text (Mac / Linux / Windows)
• Atom (Mac / Linux / Windows)
• Microsoft VS Code (Mac / Linux / Windows)
• vim (Mac / Linux)
Text Editors
Slide 27
Slide 27 text
• PHPStorm (Mac / Linux / Windows)
• Eclipse (Mac / Linux / Windows)
• Komodo (Mac / Linux / Windows)
Integrated Development
Environments
Slide 28
Slide 28 text
• emacs (Mac / Linux / Unix / Everything else)
Operating Systems With Built
In Text Editors
Slide 29
Slide 29 text
Development Environments
• On your server
• On your machine
• On your machine, but it acts like the server
Slide 30
Slide 30 text
Development Environments
• FTP Development
• “Cowboy coding”
• Local Environments
• MAMP / LAMP / Vagrant
• Next generation
• Kalabox / Lando CLI (And other Docker setups)
• DrupalVM / Homestead (And other Vagrant setups)
Slide 31
Slide 31 text
• FTP Development
• “Cowboy coding”
• No version control up front
• Little debugging visibility
• Log files (maybe), debug statements
• Watchdog logs (maybe)
FTP Development
Slide 32
Slide 32 text
• print_r()
• Raw dump of a variable or context, no formatting
• print_r($node);
•
• dsm() / kint()
• Formatted dump of a variable or context
• dsm($node);
Debug Statements in Code
Slide 33
Slide 33 text
• MAMP / Dev Desktop / Native LAMP
• Code runs entirely locally
• Added bonus of offline work, no internet required
• print_r(), dsm(), kint(), but also more
• xdebug
Local Development
Slide 34
Slide 34 text
• Kalabox / Lando with Pantheon / Acquia integration
• DrupalVM / Homestead and other Vagrant boxes
• print_r(), dsm(), kint(), xdebug
• Very accurate performance profiling
• XHProf
• Blackfire
• Tidewater
Local Development:
The Next Generation
Slide 35
Slide 35 text
What’s xdebug?
Slide 36
Slide 36 text
• Hitting pause on code execution
• Inspecting the current state of “the stack”
• Modifying values live
xdebug: Step Through
Debugging
Slide 37
Slide 37 text
Something Is Broken!
Slide 38
Slide 38 text
No content
Slide 39
Slide 39 text
Relax.
Slide 40
Slide 40 text
No content
Slide 41
Slide 41 text
Relax.
Slide 42
Slide 42 text
Remember Cobble’s Knot
Slide 43
Slide 43 text
• Is something not showing up?
• New content - is it published?
• Old content - are permissions set properly?
• Is something showing up that shouldn’t?
• Raw HTML and Javascript in a WYSIWYG field?
What’s Broken?
Slide 44
Slide 44 text
• Log Files
• You should learn how to find your log files
before you need your log files
• multitail
• Linux / Mac utility to easily view logs
with more options than tail
Work From The Bottom Up
Slide 45
Slide 45 text
• Custom Module
• template.php / .theme file
• Theme Template
Where Is It Broken?
Slide 46
Slide 46 text
No content
Slide 47
Slide 47 text
The Scientific Method
Slide 48
Slide 48 text
• Change one thing at a time
• Test that change
• Repeat
Finally, Debugging
Slide 49
Slide 49 text
• Save your progress as you work
• Recreate your Features or config yml
• Makes rabbit holes manageable
git Is Your Friend
Slide 50
Slide 50 text
• Let’s you isolate changes between commits
git bisect Is Your Friend
Slide 51
Slide 51 text
git bisect Is Your Friend
Slide 52
Slide 52 text
git bisect Is Your Friend
Slide 53
Slide 53 text
• Remove your debug statements
• Ensure you only changed as much as you
needed to change
• You only commit print_r(‘Butts’); to master once
git diff Is Your Friend
Slide 54
Slide 54 text
git blame Finds Your Enemies
Slide 55
Slide 55 text
git blame Finds Your Enemies
Slide 56
Slide 56 text
git blame Is Your Friend
Slide 57
Slide 57 text
• Can help you track down who wrote
the offending code
• This should not be a witch hunt
• This should be a chance to find
context for the issue
git annotate Is Your Friend
Slide 58
Slide 58 text
Other Debugging Methods
Slide 59
Slide 59 text
• Walk away. Seriously.
• Talk to a coworker.
• Talk to a rubber duck.
• Write it down. By hand.
Debugging Techniques
• The Art of Troubleshooting by Jason Maxham
• https://artoftroubleshooting.com/book/
• Debugging: The 9 Indispensable Rules for Finding Even the Most Elusive
Software and Hardware Problems by David Agans
• http://debuggingrules.com
• Debugging During Development in Drupal 8 by Allie Jones
• https://www.gitbook.com/book/zivtech/debug-tools-for-drupal8/
• Using the PhpStorm Debugger by JetBrains
• https://confluence.jetbrains.com/x/_idqAw
• Maniac Magee by Jerry Spinelli
• https://www.worldcat.org/oclc/20422223
Further
Reading
Slide 63
Slide 63 text
Thanks!
Questions?
War stories?
@milsyobtaf
https://github.com/milsyobtaf/prez