Debugging Effectively - SunshinePHP 2017
-
Upload
colin-odell -
Category
Technology
-
view
83 -
download
1
Transcript of Debugging Effectively - SunshinePHP 2017
![Page 1: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/1.jpg)
Photo by Joseph B // cc by-nc-nd 2.0 // https://flic.kr/p/7GAMBe
Debugging Effectively
Colin O’Dell
@colinodell
![Page 2: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/2.jpg)
OverviewI. Importance of debuggingII. Debugging processIII. Tools & TechniquesIV. Q&A
Photo by Roman Boed // cc by 2.0 // https://flic.kr/p/ngwcf1
@colinodell
![Page 3: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/3.jpg)
Debugging is...Photo by Ewan Cross // cc by-nc-nd 2.0 // https://flic.kr/p/7MCt3m
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (adjective)
@colinodell
![Page 4: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/4.jpg)
Debugging is...Photo by Ewan Cross // cc by-nc-nd 2.0 // https://flic.kr/p/7MCt3m
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (adjective)
@colinodell
![Page 5: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/5.jpg)
Debugging is...Photo by Ewan Cross // cc by-nc-nd 2.0 // https://flic.kr/p/7MCt3m
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (adjective)
@colinodell
![Page 6: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/6.jpg)
Debugging is...Photo by Ewan Cross // cc by-nc-nd 2.0 // https://flic.kr/p/7MCt3m
important@colinodell
![Page 7: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/7.jpg)
Debugging is...Photo by Ewan Cross // cc by-nc-nd 2.0 // https://flic.kr/p/7MCt3m
the single most important skill in
programming.@colinodell
![Page 8: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/8.jpg)
Photo by florianric // cc by 2.0 // https://flic.kr/p/c4QJzC
PlanningCoding
@colinodell
![Page 9: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/9.jpg)
Photo by florianric // cc by 2.0 // https://flic.kr/p/c4QJzC
Planning
Testing & Debugging
Coding
@colinodell
![Page 10: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/10.jpg)
Debugging is the process of finding and resolving bugs or defects that prevent correct operation of computer software or a system.
– Wikipedia
Photo by Stephen Dyrgas // cc by-nc-nd 2.0 // https://flic.kr/p/3eTfWU
![Page 11: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/11.jpg)
Process is the foundation of effective debugging
Process
Photo by Matthew Paulson // cc by-nc-nd 2.0 // https://flic.kr/p/di35xa
![Page 12: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/12.jpg)
Photo by Matthew Paulson // cc by-nc-nd 2.0 // https://flic.kr/p/di35xa
Gain experience with code and tools
Experience
Process
![Page 13: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/13.jpg)
Photo by Matthew Paulson // cc by-nc-nd 2.0 // https://flic.kr/p/di35xa
Develop a “sixth sense”
“Sixth Sense
”Experience
Process
![Page 14: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/14.jpg)
Junior Developers• Try the “usual” steps• bin/console cache:clear• composer install• chmod –R 777 *
• Ask somebody else• Co-worker• Google• StackOverflow post
Photo by Yoel Ben-Avraham, with changes // cc by--nd 2.0 // https://flic.kr/p/6pmtQL
@colinodell
![Page 15: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/15.jpg)
XY ProblemPhoto by Yoel Ben-Avraham, with changes // cc by--nd 2.0 // https://flic.kr/p/6pmtQL
•I want to solve problem X•How do I solve X?
@colinodell
![Page 16: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/16.jpg)
XY ProblemPhoto by Yoel Ben-Avraham, with changes // cc by--nd 2.0 // https://flic.kr/p/6pmtQL
•I want to solve problem X•How do I solve X?•Solution Y might work•How can I do Y?
@colinodell
![Page 17: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/17.jpg)
Photo by quattrostagioni // cc by 2.0 // https://flic.kr/p/aGjVq8
1.Don’t parse HTML with regex2.Solve problems the right way
@colinodell
![Page 18: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/18.jpg)
“I don’t know why”
“For some reason”
“Doesn’t make sense”
Photo by Stanley Yuu // cc by-nc-nd 2.0 // https://flic.kr/p/pMnfNu
@colinodell
![Page 19: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/19.jpg)
Bugs are logical
Photo by Photofest
@colinodell
![Page 20: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/20.jpg)
“The bug is not moving around in your code, trying to trick or evade you. It is just siting in one place, doing the wrong thing in the same
way every time.” – Nick Parlante, Debugging Zen
Photo by GrahamC57 // cc by-nc-nd 2.0 // https://flic.kr/p/cwJi9Q
@colinodell
![Page 21: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/21.jpg)
Assume your code is the problem
Photo by Sergio Flores Rosales // cc by-nc-nd 2.0 // https://flic.kr/p/5UHkaW
@colinodell
![Page 22: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/22.jpg)
Systematic Approach
1. Gather information2. Replicate the issue3. Identify the culprit4. Fix it & re-test5. Mitigate future occurrences
Photo from EduSpiral // cc by-nc-nd 3.0
@colinodell
![Page 23: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/23.jpg)
1. Gather information
• Expected behavior vs.actual behavior• Error messages• Stack traces
Photo from youmustdesireit.wordpress.com
• Screenshots•Browser & OS•Date & time• Log entries
@colinodell
![Page 24: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/24.jpg)
2. Replicate the Issue
Be able to replicate with 100% certainty
Photo by Nick Royer // cc by-sa // https://flic.kr/p/d41ASC
@colinodell
![Page 25: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/25.jpg)
3. Identify the CulpritPhoto by U.S. Navy // cc 2.0 // https://flic.kr/p/n6Wgks
• Be methodical• Make no assumptions• Understand the bug
@colinodell
![Page 26: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/26.jpg)
4. Fix it & Re-test• Attempt to replicate again• Avoid XY problem• No temporary workarounds!• Add technical debt• May introduce other issues• Never get replaced with true solutions
Photo by Jeff Eaton // cc by-sa 2.0 // https://flic.kr/p/b33rSx
@colinodell
![Page 27: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/27.jpg)
5. Mitigate Future Occurrences•Add an automated test• Share your new knowledge• Project documentation• Blog post• StackOverflow
• Submit patch upstream
Photo by marcokalmann // cc by-nc-nd 2.0 // https://flic.kr/p/4CqLMQ
@colinodell
![Page 28: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/28.jpg)
Recap
1. Gather information2. Replicate the issue3. Identify the culprit4. Fix it & re-test5. Mitigate future occurrences
Photo from EduSpiral // cc by-nc-nd 3.0
@colinodell
![Page 29: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/29.jpg)
Long-Term Results
• Gain experience• Learn how the system works• Build heuristics• Boost confidence
Photo by Glenn Beltz // cc by 2.0 // https://flic.kr/p/i7Csdx
@colinodell
![Page 30: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/30.jpg)
Tools & Techniques
Photo by Alan // cc by-nc-sa 2.0 // https://flic.kr/p/9azLii
@colinodell
![Page 31: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/31.jpg)
Two essential tools
• Integrated development environment (IDE)• Interactive debugger
Photo by florianric // cc by 2.0 // https://flic.kr/p/c4QJzC
@colinodell
![Page 32: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/32.jpg)
Integrated Development Environment•Minimum features:•Syntax highlighting•Auto-completion•Fast code navigation•Debugger
Photo by florianric // cc by 2.0 // https://flic.kr/p/c4QJzC
@colinodell
![Page 33: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/33.jpg)
Interactive Debugger
•Pause code execution•Breakpoints•Conditional breakpoints
•Step through execution•Examine variables•Explore call stack
Photo by florianric // cc by 2.0 // https://flic.kr/p/c4QJzC
@colinodell
![Page 34: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/34.jpg)
@colinodell
![Page 35: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/35.jpg)
Techniques1. Trace backwards from known issue2. Trace forwards from start 3. Binary search4. Use tools5. Get help6. Take a break
Photo by Massmo Relsig // cc by-nc-nd 2.0 // https://flic.kr/p/pFrJCe
@colinodell
![Page 36: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/36.jpg)
1. Trace backwards•Use a debugger• Identify source of error•Establish context•Work backwards
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
@colinodell
![Page 37: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/37.jpg)
1. Trace backwards•Use a debugger• Identify source of error•Establish context•Work backwards
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 38: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/38.jpg)
1. Trace backwards•Use a debugger• Identify source of error•Establish context•Work backwards
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 39: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/39.jpg)
1. Trace backwards•Use a debugger• Identify source of error•Establish context•Work backwards
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 40: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/40.jpg)
1. Trace backwards•Use a debugger• Identify source of error•Establish context•Work backwards
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 41: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/41.jpg)
1. Trace backwards•Use a debugger• Identify source of error•Establish context•Work backwards
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 42: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/42.jpg)
2. Trace forwards•Opposite direction•Problematic lineisn’t known•Use debugger or logging
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 43: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/43.jpg)
2. Trace forwards•Opposite direction•Problematic lineisn’t known•Use debugger or logging
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 44: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/44.jpg)
2. Trace forwards•Opposite direction•Problematic lineisn’t known•Use debugger or logging
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 45: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/45.jpg)
2. Trace forwards•Opposite direction•Problematic lineisn’t known•Use debugger or logging
a()
b()
c()
d()
Photo by Shawn Harquail // cc by-nc 2.0 // https://flic.kr/p/npxFVw
![Page 46: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/46.jpg)
3. Divide & Conquer• Identify different code sections• Set breakpoints at the boundaries• Isolate issue to one particular area• Focus efforts on that area
@colinodell
![Page 47: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/47.jpg)
@colinodell
![Page 48: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/48.jpg)
@colinodell
![Page 49: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/49.jpg)
@colinodell
![Page 50: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/50.jpg)
✓
X@colinodell
![Page 51: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/51.jpg)
@colinodell
![Page 52: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/52.jpg)
4. Use tools•Variable dumps•Debug toolbars•Console utility•Profilers•git bisect
•netcat•curl• strace•etc.
Photo by florianric // cc by 2.0 // https://flic.kr/p/c4QJzC
@colinodell
![Page 53: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/53.jpg)
Variable dumpsPhoto by Joseph B // cc by-nc-nd 2.0 // https://flic.kr/p/7GAMBe
•var_dump()•kint()•file_put_contents()
@colinodell
![Page 54: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/54.jpg)
Photo by Joseph B // cc by-nc-nd 2.0 // https://flic.kr/p/7GAMBe
Debug toolbars
@colinodell
![Page 55: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/55.jpg)
Photo by Joseph B // cc by-nc-nd 2.0 // https://flic.kr/p/7GAMBe
Console Utility
Drupal: drushDrupal Console
Symfony: bin/consoleMagento: n98-magerunLaravel: artisan
@colinodell
![Page 56: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/56.jpg)
Performance Profiling
Identify slowness:• Bottlenecks• Resource hogs• Inefficient code
Photo by Alan Stark // cc by-sa 2.0 // https://flic.kr/p/dn3qjx
Tools:• Blackfire (freemium)• New Relic (freemium)• xhprof (open-source)
@colinodell
![Page 57: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/57.jpg)
git bisect
v1.7 ? ? ? ? ? ? ? HEAD
Photo by unbekannt270 // cc by 2.0 // https://flic.kr/p/oHReqm
@colinodell
![Page 58: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/58.jpg)
git bisect
v1.7 ? ? ? ? ? ? ? HEAD
Photo by unbekannt270 // cc by 2.0 // https://flic.kr/p/oHReqm
@colinodell
![Page 59: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/59.jpg)
git bisect
v1.7 ? ? ? BAD ? ? ? HEAD
Photo by unbekannt270 // cc by 2.0 // https://flic.kr/p/oHReqm
@colinodell
![Page 60: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/60.jpg)
git bisect
v1.7 ? ? ? BAD BAD BAD BAD HEAD
Photo by unbekannt270 // cc by 2.0 // https://flic.kr/p/oHReqm
@colinodell
![Page 61: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/61.jpg)
git bisect
v1.7 ? GOOD ? BAD BAD BAD BAD HEAD
Photo by unbekannt270 // cc by 2.0 // https://flic.kr/p/oHReqm
@colinodell
![Page 62: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/62.jpg)
git bisect
v1.7 GOOD GOOD ? BAD BAD BAD BAD HEAD
Photo by unbekannt270 // cc by 2.0 // https://flic.kr/p/oHReqm
@colinodell
![Page 63: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/63.jpg)
git bisect
v1.7 GOOD GOOD X BAD BAD BAD BAD HEAD
Photo by unbekannt270 // cc by 2.0 // https://flic.kr/p/oHReqm
abcd123 is the first bad commit @colinodell
![Page 64: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/64.jpg)
Photo by Joseph B // cc by-nc-nd 2.0 // https://flic.kr/p/7GAMBe
netcat
@colinodell
![Page 65: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/65.jpg)
Photo by Joseph B // cc by-nc-nd 2.0 // https://flic.kr/p/7GAMBe
curl
@colinodell
![Page 66: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/66.jpg)
Photo by Joseph B // cc by-nc-nd 2.0 // https://flic.kr/p/7GAMBe
strace
@colinodell
![Page 67: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/67.jpg)
5. Get help•RTFM / RTFD•Project forums or issue queue• StackOverflow, IRC, etc.•Ask a colleague• Expert in that area• Senior developer
•Rubber ducking
Photo by Hiromitsu Morimoto // cc by-sa 2.0 // https://flic.kr/p/6Vzzaa
@colinodell
![Page 68: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/68.jpg)
6. Take a break
Photo by Kristina Alexadnerson // cc by-nc-nd 2.0 // https://flic.kr/p/cFEcDC
• Clear your mind; start fresh• Forget invalid assumptions• Recharge your batteries• Let your subconscious work on it
@colinodell
![Page 69: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/69.jpg)
Four things to walk away with
1. Computers aren’t random,and neither are bugs
2. Persistence will always pay off3. Don’t be afraid to dive deep4. Don’t make assumptions or
take things for granted
Photo by Kristina Alexadnerson // cc by-nc-nd 2.0 // https://flic.kr/p/dvEpfY
@colinodell
![Page 70: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/70.jpg)
Questions?
Photo by Marcello Maria Perongini // cc by-nc-nd 2.0 // https://flic.kr/p/6KDtm
@colinodell
![Page 71: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/71.jpg)
Learn More• https://web.duke.edu/cps001/notes/Debugging.pdf• http://www.fiveminutegeekshow.com/20• http://blog.codeunion.io/2014/09/03/teaching-novices-how-to-debug-co
de/• https://www.jetbrains.com/phpstorm/help/debugging.html• http://www.sitepoint.com/debugging-git-blame-bisect/• http://unix.stackexchange.com/a/50099/80744• http://codeception.com/docs/01-Introduction• http://chadfowler.com/blog/2014/01/26/the-magic-of-strace/ • http://c2.com/cgi/wiki?RubberDucking
Photo by Samantha Marx // cc by 2.0 // https://flic.kr/p/8KrU1R
@colinodell
![Page 72: Debugging Effectively - SunshinePHP 2017](https://reader036.fdocuments.in/reader036/viewer/2022070600/589a04c91a28ab7a318b4779/html5/thumbnails/72.jpg)
Thanks!Feedback Appreciated!• https://joind.in/talk/a2d4c• @colinodell / [email protected]
Photo by Steve Rotman // cc by-nc-nd 2.0 // https://flic.kr/p/xiBK