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
480
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
230
Going Polyglot the Easy Way
sharnik
0
470
Why TDD is a dangerous sect
sharnik
4
310
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
440
What's New in Android 2026
veronikapj
0
230
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
180
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
410
Google Apps Script で Ruby を動かす
kawahara
0
110
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
440
Claude Team Plan導入・ガイド
tk3fftk
0
240
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.8k
今さら聞けない .NET CLI
htkym
0
150
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
330
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
0
170
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
440
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Product Roadmaps are Hard
iamctodd
55
12k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
160
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
190
My Coaching Mixtape
mlcsv
0
180
Being A Developer After 40
akosma
91
590k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
400
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Raft: Consensus for Rubyists
vanstee
141
7.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Scaling GitHub
holman
464
140k
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