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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
sharnik
June 17, 2015
Programming
470
0
Share
Debugging
Presentation about debugging for people just learning to program.
sharnik
June 17, 2015
More Decks by sharnik
See All by sharnik
Cross-platform Mobile Development with React Native
sharnik
0
220
Going Polyglot the Easy Way
sharnik
0
460
Why TDD is a dangerous sect
sharnik
4
310
Other Decks in Programming
See All in Programming
ファインチューニングせずメインコンペを解く方法
pokutuna
0
270
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
200
事業会社でのセキュリティ長期インターンについて
masachikaura
0
230
飯MCP
yusukebe
0
480
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
220
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
3
500
へんな働き方
yusukebe
6
2.9k
安いハードウェアでVulkan
fadis
1
910
Radical Imagining - LIFT 2025-2027 Policy Agenda
lift1998
0
240
感情を設計する
ichimichi
5
1.2k
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
180
Rethinking API Platform Filters
vinceamstoutz
0
9.2k
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
450
New Earth Scene 8
popppiees
2
2k
Ethics towards AI in product and experience design
skipperchong
2
250
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
Believing is Seeing
oripsolob
1
110
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
190
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
The SEO identity crisis: Don't let AI make you average
varn
0
430
Unsuck your backbone
ammeep
672
58k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Designing Powerful Visuals for Engaging Learning
tmiket
1
330
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
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