Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Debugging
Search
sharnik
June 17, 2015
Programming
0
430
Debugging
Presentation about debugging for people just learning to program.
sharnik
June 17, 2015
Tweet
Share
More Decks by sharnik
See All by sharnik
Cross-platform Mobile Development with React Native
sharnik
0
190
Going Polyglot the Easy Way
sharnik
0
420
Why TDD is a dangerous sect
sharnik
4
300
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
820
CloudRun, Spanner に対する負荷試験の反省と オブザーバビリティによるアプローチ
oyasumipants
1
200
ML.NETで始める機械学習
ymd65536
0
250
Datadog DBMでなにができる? JDDUG Meetup#7
nealle
0
160
Datadog Workflow Automation で圧倒的価値提供
showwin
1
330
若手バックエンドエンジニアが Elasticsearch を使ってみた話
hott0mott0
1
100
The Price of Micro Frontends… and Your Alternatives @bastacon 2025 in Frankfurt
manfredsteyer
PRO
0
280
PRレビューのお供にDanger
stoticdev
1
250
【AI 自走型】Figma からデザインコーディングを行うプロンプト
tetsuro_b
0
110
Boos Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
770
DRFを少しずつ オニオンアーキテクチャに寄せていく DjangoCongress JP 2025
nealle
2
300
Duke on CRaC with Jakarta EE
ivargrimstad
0
330
Featured
See All Featured
RailsConf 2023
tenderlove
29
1k
The Cult of Friendly URLs
andyhume
78
6.2k
We Have a Design System, Now What?
morganepeng
51
7.4k
Visualization
eitanlees
146
15k
Code Reviewing Like a Champion
maltzj
521
39k
Making Projects Easy
brettharned
116
6.1k
Statistics for Hackers
jakevdp
797
220k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Six Lessons from altMBA
skipperchong
27
3.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Documentation Writing (for coders)
carmenintech
69
4.6k
Transcript
Wojciech @sharnik haikuco.de
Programming is like riding a bike.
Except the bike is on fire and you're on fire
and everything is on fire and you're actually in hell.
None
Main programming tasks: » Adding bugs » Removing bugs
Debugging
Know what you're trying to do
Inputs -> Program -> Outputs Calculator.add(2, 3) # => 5
Workflow
Reproduce the error
Make a hypothesis
Fix
Profit
If that didn't help, rollback
Techniques
Puts debugging class Calculator def add(a, b) puts a puts
b a + b end end result = Calculator.new.add(2, 3) puts result
strings vs numbers ruby -e "x = 3; puts x"
# => 3 ruby -e "x = '3'; puts x" # => 3 ruby -e "x = 3; puts x.inspect" # => 3 ruby -e "x = '3'; puts x.inspect" # => "3"
p: shorter puts X.inspect class Calculator def add(a, b) p
a p b a + b end end result = Calculator.new.add(2, 3) p result
debugger: pry + byebug require 'pry-byebug' class Calculator def add(a,
b) binding.pry a + b end end Calculator.new.add(2, 3)
Strategies
"Wolf fence" algorithm
Rubber duck debugging
Practice
Exercise gist.github.com/sharnik/2aedd681e6bcf81a7697 Remember » understand expectations » pinpoint where the
bug is » find what the bug is » fix it