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
360
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
160
Going Polyglot the Easy Way
sharnik
0
390
Why TDD is a dangerous sect
sharnik
4
290
Other Decks in Programming
See All in Programming
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
Folding Cheat Sheet #2
philipschwarz
PRO
0
110
元気予報
suu_mire0726
0
860
脱・初心者!脱・マネコン!AWS CDKを使ってみませんか!?
har1101
0
300
Ruby Pattern Matching
bkuhlmann
0
920
Folding Cheat Sheet #1
philipschwarz
PRO
0
210
Code Reviews
bkuhlmann
4
880
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
120
SpringBoot+MyBatisで例外が出たときどこを見るか
syukai
0
110
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
300
코틀린으로 멀티플랫폼 만들기
pangmoo
0
120
Javaエンジニアのための Nodejs/Nuxt3入門
hidekatsu_izuno
0
280
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
Building a Scalable Design System with Sketch
lauravandoore
455
32k
Creatively Recalculating Your Daily Design Routine
revolveconf
209
11k
No one is an island. Learnings from fostering a developers community.
thoeni
14
2.1k
BBQ
matthewcrist
80
8.7k
Navigating Team Friction
lara
177
13k
Bash Introduction
62gerente
604
210k
10 Git Anti Patterns You Should be Aware of
lemiorhan
646
57k
Fantastic passwords and where to find them - at NoRuKo
philnash
36
2.5k
How to name files
jennybc
64
92k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.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