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
460
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
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.7k
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.7k
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
360
AgentCoreとHuman in the Loop
har1101
5
200
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
1.9k
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
2.4k
CSC307 Lecture 04
javiergs
PRO
0
650
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
940
gunshi
kazupon
1
140
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
160
CSC307 Lecture 01
javiergs
PRO
0
680
Data-Centric Kaggle
isax1015
2
720
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Building Applications with DynamoDB
mza
96
6.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
110
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
300
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
66
36k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Thoughts on Productivity
jonyablonski
74
5k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
110
GraphQLとの向き合い方2022年版
quramy
50
14k
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