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
440
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
430
Why TDD is a dangerous sect
sharnik
4
300
Other Decks in Programming
See All in Programming
Rethinking Data Access: The New httpResource in Angular
manfredsteyer
PRO
0
220
Rails産でないDBを Railsに引っ越すHACK - Omotesando.rb #110
lnit
1
120
がんばりすぎないコーディングルール運用術
tsukakei
1
190
型付け力を強化するための Hoogle のすゝめ / Boosting Your Type Mastery with Hoogle
guvalif
1
240
Proxmoxをまとめて管理できるコンソール作ってみました
karugamo
1
430
バランスを見極めよう!実装の意味を明示するための型定義 TSKaigi 2025 Day2 (5/24)
whatasoda
2
780
當開發遇上包裝:AI 如何讓產品從想法變成商品
clonn
0
2.6k
AIにコードを生成するコードを作らせて、再現性を担保しよう! / Let AI generate code to ensure reproducibility
yamachu
7
6.1k
バリデーションライブラリ徹底比較
nayuta999999
1
460
iOSアプリ開発もLLMで自動運転する
hiragram
6
2.2k
『Python → TypeScript』オンボーディング奮闘記
takumi_tatsuno
1
140
Use Perl as Better Shell Script
karupanerura
0
660
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
76
5.8k
Rails Girls Zürich Keynote
gr2m
94
13k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
460
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
15
890
Git: the NoSQL Database
bkeepers
PRO
430
65k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
GraphQLとの向き合い方2022年版
quramy
46
14k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
What's in a price? How to price your products and services
michaelherold
245
12k
Balancing Empowerment & Direction
lara
1
91
Why Our Code Smells
bkeepers
PRO
336
57k
Writing Fast Ruby
sferik
628
61k
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