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
390
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
170
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
開発部に不満を持っていたCSがエンジニアにジョブチェンしてわかった「勝手に諦めない」ことの大切さ
sakuraikotone
28
16k
英語
s_shimotori
1
220
AWS CDKにおける「再利用性」を考える / aws-cdk-reusability
gotok365
6
1.3k
Composing an API the *right* way (Droidcon Berlin 2024)
zsmb
1
450
企業向け生成AIアプリの 開発から得られた知見
takaakikakei
0
310
12年前の『型システム入門』翻訳の思い出話
mame
11
1.2k
はしめてのプログラミングとロボット制御
watawatavoltage
0
290
DMMプラットフォームにおけるTiDBの導入から運用まで
pospome
7
3k
継続的な活動で築く地方エンジニアの道
myamashii
2
350
Microservices rules (July 2024) : what good looks like
cer
PRO
0
1.6k
Prompt FlowによるLLMアプリケーション開発
yuto2000
1
1k
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
250
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
16
1.6k
Writing Fast Ruby
sferik
623
60k
Typedesign – Prime Four
hannesfritz
37
2.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
129
32k
GraphQLとの向き合い方2022年版
quramy
36
13k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
20
7.2k
YesSQL, Process and Tooling at Scale
rocio
166
14k
How to Ace a Technical Interview
jacobian
274
23k
Designing Experiences People Love
moore
136
23k
A better future with KSS
kneath
231
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
357
18k
The Pragmatic Product Professional
lauravandoore
29
6.1k
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