SlideShare una empresa de Scribd logo
1 de 8
Descargar para leer sin conexión
THUNDER THURSDAY
INSIGHTS – 8
DEBUG EFFICIENTLY AND
EFFECTIVELY!
1
Even if you have fixed something, it is
done without having reproduced the
original bug and having no idea what
you have actually done. So, always find
the exact steps to reproduce the bug. If
you can’t reproduce it, find someone
who can!
Always Reproduce the Bug Before You Start
Changing Code
Never just see the description of a problem, immediately make
some random assumptions, proceed to make changes in the code
cause soon you will find it’s not fixed.
2 Understand Stack Traces
99% of time the stack trace will come
from a bad assumption in your OWN
code. Now it may not be that exact line
which has the bug, but you’ll need to
work backwards up through the code to
find where a bad argument was perhaps
passed in.
Therefore:
Always wrap exceptions thrown to you!
Not every bug will have a stack trace, but most of them
do. The key to remember is that the root cause, the
filthy culprit that broke your perfect day, is usually
wrapped up several layers deep.
So work from the bottom of the scary long stack trace upwards to find the
root cause!
3 Know Your Error Codes
404 - You might have the wrong url in your app
401 - Your credentials are likely wrong
418 - You’re talking to a teapot!
(seriously https://tools.ietf.org/html/rfc2324)
429 - You’re making too many requests
Given how fundamental HTTP is to pretty much every
app these days, knowing what the HTTP error code
means can be a huge help in diagnosing bugs!
If you get an HTTP error code, always Google it to make sure you
understand it. Again, it’ll save you a lot of time! The same goes for
Database drivers and other protocols. If you see an error code,
Google it with the name of the database and look for the official
docs.
4 Google! Bing! Duck! Duck! Go!
Whatever your search engine of choice is, you're sure to find a
helpful answer somewhere in the internet. Just gather up as
much information as possible before you hit "search" in the
search engine.
5 Pair Program Your Way Out of It
Bring in a colleague, a friend (or a
CodeMentor) and talk them through it.
Show them the bug and the code, tell
them everything that you’ve tried and
explain to them what you think the
problem is. You would be shocked to
find out how often just the simple fact
that you’re talking it through and having
If you find yourself spending more than 30 minutes
hacking away and not making any progress, stop
right there!
to explain it to someone else can suddenly help you see what the
issue really is. Other times, it might actually be a complex issue (like
a race condition) and having a second set of eyes can help pick up
edge cases and scenario’s you have not even considered.
6 Celebrate Your Fix!
Whether you turned a test
from red to green or closed
out a ticket on your queue,
give yourself a solid high-
five. You've just saved the
day and deserve all the
credit coming your way on
this one.
DEBUG IT!

Más contenido relacionado

Similar a EduSparkz Thunder Thursday Debugging Code

Scottish Ruby Conference 2014
Scottish Ruby Conference  2014Scottish Ruby Conference  2014
Scottish Ruby Conference 2014
michaelag1971
 
10 Reasons Why You Fix Bugs As Soon As You Find Them
10 Reasons Why You Fix Bugs As Soon As You Find Them10 Reasons Why You Fix Bugs As Soon As You Find Them
10 Reasons Why You Fix Bugs As Soon As You Find Them
Rosie Sherry
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdo
daniil3
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Andre Leal
 
Computer basics from the techs
Computer basics from the techsComputer basics from the techs
Computer basics from the techs
Karen Brooks
 

Similar a EduSparkz Thunder Thursday Debugging Code (20)

10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming
 
Scottish Ruby Conference 2014
Scottish Ruby Conference  2014Scottish Ruby Conference  2014
Scottish Ruby Conference 2014
 
Software engineering 101 - The basics you should hear about at least once
Software engineering 101 - The basics you should hear about at least onceSoftware engineering 101 - The basics you should hear about at least once
Software engineering 101 - The basics you should hear about at least once
 
10 Reasons Why You Fix Bugs As Soon As You Find Them
10 Reasons Why You Fix Bugs As Soon As You Find Them10 Reasons Why You Fix Bugs As Soon As You Find Them
10 Reasons Why You Fix Bugs As Soon As You Find Them
 
Debugging
DebuggingDebugging
Debugging
 
30% faster coder on-boarding when you have a code cookbook
30% faster coder on-boarding when you have a code cookbook30% faster coder on-boarding when you have a code cookbook
30% faster coder on-boarding when you have a code cookbook
 
Introducing XP
Introducing XPIntroducing XP
Introducing XP
 
5.1 12 Rules to Learn to Code eBook [Updated 26.11.18].pdf.pdf
5.1 12 Rules to Learn to Code eBook [Updated 26.11.18].pdf.pdf5.1 12 Rules to Learn to Code eBook [Updated 26.11.18].pdf.pdf
5.1 12 Rules to Learn to Code eBook [Updated 26.11.18].pdf.pdf
 
Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdo
 
Introduction toprogramming
Introduction toprogrammingIntroduction toprogramming
Introduction toprogramming
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Software Debugging for High-altitude Balloons
Software Debugging for High-altitude BalloonsSoftware Debugging for High-altitude Balloons
Software Debugging for High-altitude Balloons
 
11 rules for programmer should live by
11 rules for programmer should live by11 rules for programmer should live by
11 rules for programmer should live by
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
Debugging
DebuggingDebugging
Debugging
 
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011
 
Win#23 it
Win#23 itWin#23 it
Win#23 it
 
Computer basics from the techs
Computer basics from the techsComputer basics from the techs
Computer basics from the techs
 
Lessons Learned About Software Development
Lessons Learned About Software DevelopmentLessons Learned About Software Development
Lessons Learned About Software Development
 

Más de Satish AG

Más de Satish AG (7)

Terrific Thursday Visualization 101
Terrific Thursday Visualization 101Terrific Thursday Visualization 101
Terrific Thursday Visualization 101
 
EduSparkz Thunder Thursday Concentrate Better
EduSparkz Thunder Thursday Concentrate BetterEduSparkz Thunder Thursday Concentrate Better
EduSparkz Thunder Thursday Concentrate Better
 
Edusparkz Thunder Thursday Googlepower
Edusparkz Thunder Thursday GooglepowerEdusparkz Thunder Thursday Googlepower
Edusparkz Thunder Thursday Googlepower
 
EduSparkz Thunder Thursday Email Etiquette
EduSparkz Thunder Thursday Email EtiquetteEduSparkz Thunder Thursday Email Etiquette
EduSparkz Thunder Thursday Email Etiquette
 
EduSparkz thunder thursday linkedin
EduSparkz thunder thursday linkedinEduSparkz thunder thursday linkedin
EduSparkz thunder thursday linkedin
 
EduSparkz Thunder Thursday: Insights on Photoshop
EduSparkz Thunder Thursday: Insights on PhotoshopEduSparkz Thunder Thursday: Insights on Photoshop
EduSparkz Thunder Thursday: Insights on Photoshop
 
Swayam MOOC platform - Framework & Ideas
Swayam MOOC platform - Framework & IdeasSwayam MOOC platform - Framework & Ideas
Swayam MOOC platform - Framework & Ideas
 

Último

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Último (20)

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 

EduSparkz Thunder Thursday Debugging Code

  • 1. THUNDER THURSDAY INSIGHTS – 8 DEBUG EFFICIENTLY AND EFFECTIVELY!
  • 2. 1 Even if you have fixed something, it is done without having reproduced the original bug and having no idea what you have actually done. So, always find the exact steps to reproduce the bug. If you can’t reproduce it, find someone who can! Always Reproduce the Bug Before You Start Changing Code Never just see the description of a problem, immediately make some random assumptions, proceed to make changes in the code cause soon you will find it’s not fixed.
  • 3. 2 Understand Stack Traces 99% of time the stack trace will come from a bad assumption in your OWN code. Now it may not be that exact line which has the bug, but you’ll need to work backwards up through the code to find where a bad argument was perhaps passed in. Therefore: Always wrap exceptions thrown to you! Not every bug will have a stack trace, but most of them do. The key to remember is that the root cause, the filthy culprit that broke your perfect day, is usually wrapped up several layers deep. So work from the bottom of the scary long stack trace upwards to find the root cause!
  • 4. 3 Know Your Error Codes 404 - You might have the wrong url in your app 401 - Your credentials are likely wrong 418 - You’re talking to a teapot! (seriously https://tools.ietf.org/html/rfc2324) 429 - You’re making too many requests Given how fundamental HTTP is to pretty much every app these days, knowing what the HTTP error code means can be a huge help in diagnosing bugs! If you get an HTTP error code, always Google it to make sure you understand it. Again, it’ll save you a lot of time! The same goes for Database drivers and other protocols. If you see an error code, Google it with the name of the database and look for the official docs.
  • 5. 4 Google! Bing! Duck! Duck! Go! Whatever your search engine of choice is, you're sure to find a helpful answer somewhere in the internet. Just gather up as much information as possible before you hit "search" in the search engine.
  • 6. 5 Pair Program Your Way Out of It Bring in a colleague, a friend (or a CodeMentor) and talk them through it. Show them the bug and the code, tell them everything that you’ve tried and explain to them what you think the problem is. You would be shocked to find out how often just the simple fact that you’re talking it through and having If you find yourself spending more than 30 minutes hacking away and not making any progress, stop right there! to explain it to someone else can suddenly help you see what the issue really is. Other times, it might actually be a complex issue (like a race condition) and having a second set of eyes can help pick up edge cases and scenario’s you have not even considered.
  • 7. 6 Celebrate Your Fix! Whether you turned a test from red to green or closed out a ticket on your queue, give yourself a solid high- five. You've just saved the day and deserve all the credit coming your way on this one.