SlideShare a Scribd company logo
Become a Better
Developer With
Debugging
Acquia Webinar April 13 2016
http://dev.acquia.com/
Dustin Younse
Four Kitchens, Engineer
@milsyobtaf
Rob Ristroph
Technical Architect, Acquia
@robgr
Who
● Live in Austin and Boston
● Work in Boston and Austin
● Four Kitchens and Acquia
● A lot of experience debugging and developing !
Outline
1. What is a Bug
2. What is Debugging
3. Why it is Important
4. “Scientific Method” Approach
5. Toolbox
6. Other tricks
7. More reading
What is a Bug
Your mental model of the code and it’s actual
behaviour don’t match.
Usually you typed code that you thought did one thing and
in fact it did another - most of the bugs you work on are
your own.
Difference from “troubleshooting” . . . .
What is a Bug
Basic Mental Model of Drupal
What is a Bug
Basic Mental Model of Drupal
What is a Bug
Basic Mental Model of Drupal
What is a Bug
Basic Mental Model of Drupal
What is a Bug
Not So Basic Mental Model of Drupal
What is a Bug - A Divergence on Origin
https://en.wikipedia.org/wiki/Software_bug#Etymology
Debugging is the Process of
Making Your Mental Model
Match Reality
● Understanding WHY the bug happened is different from
fixing it
Why is Debugging Important ?
You spend more time debugging than you do
programming. Furthermore the time
debugging is much harder to estimate.
Why is Debugging Important ?
“As soon as we started programming, we found to our
surprise that it wasn't as easy to get programs right as we
had thought. Debugging had to be discovered. I can
remember the exact instant when I realized that a large part
of my life from then on was going to be spent in finding
mistakes in my own programs.”
--Maurice Wilkes, 1949, developing the first
stored program computer
Why is Debugging Important ?
● You do it more than you realize.
● It’s the source of much uncertainty in
estimating and delivery.
● As a distinct thought process / skill, it is
possible to become good and more efficient
at it.
“Scientific Method” Approach
1. Observe (collect data, as much as possible)
2. Make a testable Hypothesis (change to your
mental model)
3. Collect data from the test
4. Adjust understanding (model), goto 1
How does this play out in real
life ?
SOMETHING IS BROKEN!
RELAX
Remember Cobble’s Knot
What Exactly is Broken ?
● Is something not showing up ?
○ New content - is it published ? Front end cache ?
○ Old content - permissions set properly, or changed ?
● Is something showing up that shouldn’t ?
○ Raw html or javascript in a wysiwyg field ?
● A more complex behavior - workbench or etc - can we state exactly the steps
to cause the bug, and why it’s not what we expect ?
Note - non technical members of your team have huge impact collecting data at
this stage.
Replicate the Bug
● User reports matter
● Worst case is making changes, waiting to see if the customer reports the
problem is still there
● Replication can be tedious, but extremely valuable
● Observe and think about your user's operating procedure
● Without being able to replicate the bug, you can't debug.
Sometimes figuring out how to replicate the bug is 99% of fixing it.
Work From the Bottom Up
● Log files
○ Know where they are on your systems / environments
● multitail
○ Linux / Mac utility to easily view logs, with more
options
● Contextual information - browsers, environments, users
Vacuum up as much information as possible in the first
stage.
Where is it Broken ?
● Custom Module
● Theme template.php
● Theme template
● Configuration in database
Potential tests - disable modules, switch themes, re-install clean without live data.
Divide-and-conquer by narrowing down where the mental model breaks.
Debugging as Scientific Method
Iteration
● Change ONE thing at a time
● Test that change
● Repeat - Undoing the change if it gave no information
Better debuggers are generally better at thinking of clever changes and tests.
● “Cheap” tests first (clear caches, etc)
● Test for common problems first
● A good test should narrow the problem scope by eliminating something
Git is your friend
● Save your progress as you work
○ Re-create your Features
○ Quickly un-do unhelpful changes
○ Makes Rabbit Holes manageable
Better debuggers generally take notes and keep a log.
Git diff is your friend
● Remove debug statements
● Ensure you only changed as much as needed
● You only commit dsm(‘Butts’); to master ONCE
Better debuggers generally take notes and keep a log.
Git blame is your friend
● Who wrote (committed) offending code
● Should NOT be a witch hunt
● Should be a chance to understand the context of the code
○ Re-reading the old Jira tickets or other requirements can cause you to
re-assess everything
Use “git annotate” in politically sensitive situations.
Make the Future Easier
● Watchdog (D7)
● Drupal::Logger() (D8)
● syslog module
● http://loggly.com
● Write a test !
Thoughtful instrumentation of your code as it’s written the first time can massively
pay off later.
“Interaction” Bugs are the Hardest
The hardest bugs are those that only appear when two “bug free” components
interact.
● Module weights, order of hook operations
○ Systematically disable modules, change weights
● Theme / module interactions
● External service requests
If your problem resists divide-and-conquer, maybe it’s not in one component or
the other, but in how they connect.
Performance Related Debugging
● Just like other debugging:
● Replicate the problem ! Otherwise you flail at random
○ Apache bench (ab), wget spiders, load generators
● Add headers, log statements, to indicate cache hits /
misses
● Different logs often apply - mysql or system logs
Further Reading (and free book!)
“Debugging: The Nine Indespensible Rules” by David J.
Agans
http://www.debuggingrules.com/
1. Understand the System
2. Make it Fail
3. Quit Thinking and Look
4. Divide and Conquer
5. Change One Thing at a Time
6. Keep an Audit Trail
7. Check the Plug
8. Get a Fresh View
9. If You Didn't Fix It, It Ain't Fixed
Conclusions . . . .
● Thinking strategically is more important than applying
fancy tools
● The hardest bugs are “Interaction” bugs
Finally . . .
Debugging can be hard to tell someone how to do, but it can
be learned if you persist and think about it. Level up !
Become a Better
Developer With
Debugging
SANDCamp 2016
https://www.sandcamp.org/session/become-better-developer-debugging-
techniques-drupal-and-more
Dustin Younse
Four Kitchens, Engineer
@milsyobtaf
Rob Ristroph
Technical Architect, Acquia
@robgr

More Related Content

What's hot (19)

PPT
Taking your module from Drupal 6 to Drupal 7
Phase2
 
PDF
Evolution of Drupal and the Drupal community
Angela Byron
 
PPTX
Top 8 Improvements in Drupal 8
Angela Byron
 
ODP
Upgrading your site from Drupal 6 to Drupal 7
Andrew Martha
 
PDF
Creating a custom API for a headless Drupal
Exove
 
PDF
Drupal 8 Render Cache
Erik Stielstra
 
PPT
Taking your site from Drupal 6 to Drupal 7
Phase2
 
PDF
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
Roberto Peruzzo
 
PDF
What is Drupal? An Introduction to Drupal 8
Suzanne Dergacheva
 
PPTX
History of Drupal: From Drop 1.0 to Drupal 8
Websolutions Agency
 
PDF
Introduction to Drupal, Wayne Eaker, Nov 11, 09
Lunch Ann Arbor Marketing
 
PDF
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Administration
DrupalMumbai
 
ODP
Conference Migrate to Drupal 8 by Leon Cros at Drupal Developer Days 2015 in ...
Chipway
 
PDF
Absolute Beginners Guide to Drupal
Rod Martin
 
PPTX
Drupal 6 to Drupal 8 Migration
Ameex Technologies
 
PDF
Drupal Flyover, CMS Expo
Emma Jane Hogbin Westby
 
PPTX
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)
Konstantin Komelin
 
PDF
Upgrading to Drupal 8: Benefits and Gotchas
Suzanne Dergacheva
 
PDF
10 New Things You Can Do with Drupal 8 Out-of-the-Box
Suzanne Dergacheva
 
Taking your module from Drupal 6 to Drupal 7
Phase2
 
Evolution of Drupal and the Drupal community
Angela Byron
 
Top 8 Improvements in Drupal 8
Angela Byron
 
Upgrading your site from Drupal 6 to Drupal 7
Andrew Martha
 
Creating a custom API for a headless Drupal
Exove
 
Drupal 8 Render Cache
Erik Stielstra
 
Taking your site from Drupal 6 to Drupal 7
Phase2
 
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
Roberto Peruzzo
 
What is Drupal? An Introduction to Drupal 8
Suzanne Dergacheva
 
History of Drupal: From Drop 1.0 to Drupal 8
Websolutions Agency
 
Introduction to Drupal, Wayne Eaker, Nov 11, 09
Lunch Ann Arbor Marketing
 
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Administration
DrupalMumbai
 
Conference Migrate to Drupal 8 by Leon Cros at Drupal Developer Days 2015 in ...
Chipway
 
Absolute Beginners Guide to Drupal
Rod Martin
 
Drupal 6 to Drupal 8 Migration
Ameex Technologies
 
Drupal Flyover, CMS Expo
Emma Jane Hogbin Westby
 
#D8CX: Upgrade your modules to Drupal 8 (Part 1 and 2)
Konstantin Komelin
 
Upgrading to Drupal 8: Benefits and Gotchas
Suzanne Dergacheva
 
10 New Things You Can Do with Drupal 8 Out-of-the-Box
Suzanne Dergacheva
 

Similar to Become a Better Developer with Debugging Techniques for Drupal (and more!) (20)

PPTX
Debugging Effectively
Colin O'Dell
 
PPTX
Debugging Effectively - SymfonyLive San Francisco 2015
Colin O'Dell
 
PPTX
Debugging Effectively - php[world] 2015
Colin O'Dell
 
PPTX
Debugging Effectively - Frederick Web Tech 9/6/16
Colin O'Dell
 
PDF
EduSparkz Thunder Thursday Debugging Code
Satish AG
 
PPTX
Debugging Effectively - ConFoo Montreal 2019
Colin O'Dell
 
PPTX
Debugging Effectively - DrupalCon Europe 2016
Colin O'Dell
 
PDF
Debugging Drupal - How to Debug your Drupal Application
Zyxware Technologies
 
PPTX
Debugging Effectively - SunshinePHP 2017
Colin O'Dell
 
PPT
How To Fix Bugs
Software Projects Inc.
 
PPTX
Debugging Effectively - DrupalCon Nashville 2018
Colin O'Dell
 
PPT
Debugging
Natasha Murashev
 
PPTX
Debugging
Natasha Murashev
 
PPTX
Debugging Effectively - ZendCon 2016
Colin O'Dell
 
PPTX
Debugging
Jonathan Holloway
 
PPTX
Debugging Effectively - All Things Open 2017
Colin O'Dell
 
PPTX
Debugging Effectively - PHP UK 2017
Colin O'Dell
 
PDF
Debugging in Software Engineering SE Unit-4 Part-6.pdf
iron57441
 
ODP
The Art Of Debugging
svilen.ivanov
 
PPTX
It Works On Dev
marcelesser
 
Debugging Effectively
Colin O'Dell
 
Debugging Effectively - SymfonyLive San Francisco 2015
Colin O'Dell
 
Debugging Effectively - php[world] 2015
Colin O'Dell
 
Debugging Effectively - Frederick Web Tech 9/6/16
Colin O'Dell
 
EduSparkz Thunder Thursday Debugging Code
Satish AG
 
Debugging Effectively - ConFoo Montreal 2019
Colin O'Dell
 
Debugging Effectively - DrupalCon Europe 2016
Colin O'Dell
 
Debugging Drupal - How to Debug your Drupal Application
Zyxware Technologies
 
Debugging Effectively - SunshinePHP 2017
Colin O'Dell
 
How To Fix Bugs
Software Projects Inc.
 
Debugging Effectively - DrupalCon Nashville 2018
Colin O'Dell
 
Debugging
Natasha Murashev
 
Debugging
Natasha Murashev
 
Debugging Effectively - ZendCon 2016
Colin O'Dell
 
Debugging Effectively - All Things Open 2017
Colin O'Dell
 
Debugging Effectively - PHP UK 2017
Colin O'Dell
 
Debugging in Software Engineering SE Unit-4 Part-6.pdf
iron57441
 
The Art Of Debugging
svilen.ivanov
 
It Works On Dev
marcelesser
 
Ad

More from Acquia (20)

PDF
Acquia_Adcetera Webinar_Marketing Automation.pdf
Acquia
 
PDF
Acquia Webinar Deck - 9_13 .pdf
Acquia
 
PDF
Taking Your Multi-Site Management at Scale to the Next Level
Acquia
 
PDF
CDP for Retail Webinar with Appnovation - Q2 2022.pdf
Acquia
 
PDF
May Partner Bootcamp 2022
Acquia
 
PDF
April Partner Bootcamp 2022
Acquia
 
PDF
How to Unify Brand Experience: A Hootsuite Story
Acquia
 
PDF
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Acquia
 
PDF
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Acquia
 
PDF
September Partner Bootcamp
Acquia
 
PDF
August partner bootcamp
Acquia
 
PDF
July 2021 Partner Bootcamp
Acquia
 
PDF
May Partner Bootcamp
Acquia
 
PDF
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
Acquia
 
PDF
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Acquia
 
PDF
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia
 
PDF
April partner bootcamp deck cookieless future
Acquia
 
PDF
How to enhance cx through personalised, automated solutions
Acquia
 
PDF
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
Acquia
 
PDF
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Acquia
 
Acquia_Adcetera Webinar_Marketing Automation.pdf
Acquia
 
Acquia Webinar Deck - 9_13 .pdf
Acquia
 
Taking Your Multi-Site Management at Scale to the Next Level
Acquia
 
CDP for Retail Webinar with Appnovation - Q2 2022.pdf
Acquia
 
May Partner Bootcamp 2022
Acquia
 
April Partner Bootcamp 2022
Acquia
 
How to Unify Brand Experience: A Hootsuite Story
Acquia
 
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Acquia
 
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Acquia
 
September Partner Bootcamp
Acquia
 
August partner bootcamp
Acquia
 
July 2021 Partner Bootcamp
Acquia
 
May Partner Bootcamp
Acquia
 
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
Acquia
 
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Acquia
 
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia
 
April partner bootcamp deck cookieless future
Acquia
 
How to enhance cx through personalised, automated solutions
Acquia
 
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
Acquia
 
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Acquia
 
Ad

Recently uploaded (20)

PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 

Become a Better Developer with Debugging Techniques for Drupal (and more!)

  • 1. Become a Better Developer With Debugging Acquia Webinar April 13 2016 http://dev.acquia.com/ Dustin Younse Four Kitchens, Engineer @milsyobtaf Rob Ristroph Technical Architect, Acquia @robgr
  • 2. Who ● Live in Austin and Boston ● Work in Boston and Austin ● Four Kitchens and Acquia ● A lot of experience debugging and developing !
  • 3. Outline 1. What is a Bug 2. What is Debugging 3. Why it is Important 4. “Scientific Method” Approach 5. Toolbox 6. Other tricks 7. More reading
  • 4. What is a Bug Your mental model of the code and it’s actual behaviour don’t match. Usually you typed code that you thought did one thing and in fact it did another - most of the bugs you work on are your own. Difference from “troubleshooting” . . . .
  • 5. What is a Bug Basic Mental Model of Drupal
  • 6. What is a Bug Basic Mental Model of Drupal
  • 7. What is a Bug Basic Mental Model of Drupal
  • 8. What is a Bug Basic Mental Model of Drupal
  • 9. What is a Bug Not So Basic Mental Model of Drupal
  • 10. What is a Bug - A Divergence on Origin https://en.wikipedia.org/wiki/Software_bug#Etymology
  • 11. Debugging is the Process of Making Your Mental Model Match Reality ● Understanding WHY the bug happened is different from fixing it
  • 12. Why is Debugging Important ? You spend more time debugging than you do programming. Furthermore the time debugging is much harder to estimate.
  • 13. Why is Debugging Important ? “As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.” --Maurice Wilkes, 1949, developing the first stored program computer
  • 14. Why is Debugging Important ? ● You do it more than you realize. ● It’s the source of much uncertainty in estimating and delivery. ● As a distinct thought process / skill, it is possible to become good and more efficient at it.
  • 15. “Scientific Method” Approach 1. Observe (collect data, as much as possible) 2. Make a testable Hypothesis (change to your mental model) 3. Collect data from the test 4. Adjust understanding (model), goto 1
  • 16. How does this play out in real life ?
  • 19. What Exactly is Broken ? ● Is something not showing up ? ○ New content - is it published ? Front end cache ? ○ Old content - permissions set properly, or changed ? ● Is something showing up that shouldn’t ? ○ Raw html or javascript in a wysiwyg field ? ● A more complex behavior - workbench or etc - can we state exactly the steps to cause the bug, and why it’s not what we expect ? Note - non technical members of your team have huge impact collecting data at this stage.
  • 20. Replicate the Bug ● User reports matter ● Worst case is making changes, waiting to see if the customer reports the problem is still there ● Replication can be tedious, but extremely valuable ● Observe and think about your user's operating procedure ● Without being able to replicate the bug, you can't debug. Sometimes figuring out how to replicate the bug is 99% of fixing it.
  • 21. Work From the Bottom Up ● Log files ○ Know where they are on your systems / environments ● multitail ○ Linux / Mac utility to easily view logs, with more options ● Contextual information - browsers, environments, users Vacuum up as much information as possible in the first stage.
  • 22. Where is it Broken ? ● Custom Module ● Theme template.php ● Theme template ● Configuration in database Potential tests - disable modules, switch themes, re-install clean without live data. Divide-and-conquer by narrowing down where the mental model breaks.
  • 23. Debugging as Scientific Method Iteration ● Change ONE thing at a time ● Test that change ● Repeat - Undoing the change if it gave no information Better debuggers are generally better at thinking of clever changes and tests. ● “Cheap” tests first (clear caches, etc) ● Test for common problems first ● A good test should narrow the problem scope by eliminating something
  • 24. Git is your friend ● Save your progress as you work ○ Re-create your Features ○ Quickly un-do unhelpful changes ○ Makes Rabbit Holes manageable Better debuggers generally take notes and keep a log.
  • 25. Git diff is your friend ● Remove debug statements ● Ensure you only changed as much as needed ● You only commit dsm(‘Butts’); to master ONCE Better debuggers generally take notes and keep a log.
  • 26. Git blame is your friend ● Who wrote (committed) offending code ● Should NOT be a witch hunt ● Should be a chance to understand the context of the code ○ Re-reading the old Jira tickets or other requirements can cause you to re-assess everything Use “git annotate” in politically sensitive situations.
  • 27. Make the Future Easier ● Watchdog (D7) ● Drupal::Logger() (D8) ● syslog module ● http://loggly.com ● Write a test ! Thoughtful instrumentation of your code as it’s written the first time can massively pay off later.
  • 28. “Interaction” Bugs are the Hardest The hardest bugs are those that only appear when two “bug free” components interact. ● Module weights, order of hook operations ○ Systematically disable modules, change weights ● Theme / module interactions ● External service requests If your problem resists divide-and-conquer, maybe it’s not in one component or the other, but in how they connect.
  • 29. Performance Related Debugging ● Just like other debugging: ● Replicate the problem ! Otherwise you flail at random ○ Apache bench (ab), wget spiders, load generators ● Add headers, log statements, to indicate cache hits / misses ● Different logs often apply - mysql or system logs
  • 30. Further Reading (and free book!) “Debugging: The Nine Indespensible Rules” by David J. Agans http://www.debuggingrules.com/ 1. Understand the System 2. Make it Fail 3. Quit Thinking and Look 4. Divide and Conquer 5. Change One Thing at a Time 6. Keep an Audit Trail 7. Check the Plug 8. Get a Fresh View 9. If You Didn't Fix It, It Ain't Fixed
  • 31. Conclusions . . . . ● Thinking strategically is more important than applying fancy tools ● The hardest bugs are “Interaction” bugs Finally . . . Debugging can be hard to tell someone how to do, but it can be learned if you persist and think about it. Level up !
  • 32. Become a Better Developer With Debugging SANDCamp 2016 https://www.sandcamp.org/session/become-better-developer-debugging- techniques-drupal-and-more Dustin Younse Four Kitchens, Engineer @milsyobtaf Rob Ristroph Technical Architect, Acquia @robgr