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
450
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
200
Going Polyglot the Easy Way
sharnik
0
440
Why TDD is a dangerous sect
sharnik
4
300
Other Decks in Programming
See All in Programming
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
700
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
520
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
130
NPOでのDevinの活用
codeforeveryone
0
650
Benchmark
sysong
0
280
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
260
Result型で“失敗”を型にするPHPコードの書き方
kajitack
4
560
GraphRAGの仕組みまるわかり
tosuri13
8
510
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
530
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
680
Select API from Kotlin Coroutine
jmatsu
1
210
童醫院敏捷轉型的實踐經驗
cclai999
0
210
Featured
See All Featured
Making Projects Easy
brettharned
116
6.3k
Visualization
eitanlees
146
16k
We Have a Design System, Now What?
morganepeng
53
7.7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
Facilitating Awesome Meetings
lara
54
6.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
4 Signs Your Business is Dying
shpigford
184
22k
Site-Speed That Sticks
csswizardry
10
670
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
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