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
470
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
210
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
Package Management Learnings from Homebrew
mikemcquaid
0
210
Fluid Templating in TYPO3 14
s2b
0
130
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
250
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
CSC307 Lecture 07
javiergs
PRO
0
550
AI & Enginnering
codelynx
0
110
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
700
「ブロックテーマでは再現できない」は本当か?
inc2734
0
890
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
Basic Architectures
denyspoltorak
0
660
Oxlintはいいぞ
yug1224
5
1.3k
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
57
50k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Speed Design
sergeychernyshev
33
1.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
ラッコキーワード サービス紹介資料
rakko
1
2.2M
A better future with KSS
kneath
240
18k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Site-Speed That Sticks
csswizardry
13
1.1k
A Tale of Four Properties
chriscoyier
162
24k
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