SlideShare une entreprise Scribd logo
1  sur  71
Télécharger pour lire hors ligne
De Frustrado a Competente
Debugging para el no iniciado:
Barcamp 2015, Santiago, R.D.
What we will cover
Barcamp 2015, Santiago, R.D.
- What is debugging
- Why is hard
- Know yourself
- The true path to debugging
- The rules of debugging
- What debugging displays
- Remember
About me
Barcamp 2015, Santiago, R.D.
Leonardo Jimenez (Un entusiasta del software)
Blog: www.leonardo.do
correo: leonardo@codetiger.co
Co-Founder and Developer @Codetiger
We love Python, We use a ton of stuff
One of the organizers of @pythondo && @Jsdo
Barcamp 2015, Santiago, R.D.
Can you tell me what debugging means to you?
What is debugging?
Barcamp 2015, Santiago, R.D.
What is debugging?
Barcamp 2015, Santiago, R.D.
Can you tell me what debugging means to you?
Some frequent answers:
- Make the error go away
- Eliminate the errors on the screen
- “Resolver…!”
What is debugging?
Barcamp 2015, Santiago, R.D.
Most of the answers are related to fixing the actual
problem ...
What is debugging?
Barcamp 2015, Santiago, R.D.
My (really recent definition) Definition
“Debugging is the process of finding and resolving bugs or
defects in the code in a manner that the code is better than
the way it was found”
What is debugging?
Barcamp 2015, Santiago, R.D.
Debugging Normally includes:
1. Get the bug in the database (if you are lucky)
2. Reproduce the problem
3. Automate and simplify the test case (if you know what you
are doing)
4. Find possible infection origins
5. Focus on the most likely origins
6. Isolate the infection chain
7. Correct the defect
What is debugging?
Barcamp 2015, Santiago, R.D.
Debugging Normally includes:
1. Get the bug in the database (if you are lucky)
2. Reproduce the problem
3. Automate and simplify the test case (if you know what you
are doing)
4. Find possible infection origins
5. Focus on the most likely origins
6. Isolate the infection chain
7. Correct the defect
{
Understand the Problem
What is debugging?
Barcamp 2015, Santiago, R.D.
Debugging Normally includes:
1. Get the bug in the database (if you are lucky)
2. Reproduce the problem
3. Automate and simplify the test case (if you know what you
are doing)
4. Find possible infection origins
5. Focus on the most likely origins
6. Isolate the infection chain
7. Correct the defect
{
Search the Problem
What is debugging?
Barcamp 2015, Santiago, R.D.
Debugging Normally includes:
1. Get the bug in the database (if you are lucky)
2. Reproduce the problem
3. Automate and simplify the test case (if you know what you
are doing)
4. Find possible infection origins
5. Focus on the most likely origins
6. Isolate the infection chain
7. Correct the defect{
Fixing it
What is debugging?
Barcamp 2015, Santiago, R.D.
Debugging Normally includes:
1. Get the bug in the database (if you are lucky)
2. Reproduce the problem
3. Automate and simplify the test case (if you know what you
are doing)
4. Find possible infection origins
5. Focus on the most likely origins
6. Isolate the infection chain
7. Correct the defect
{
Most of your time goes here
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Key Takeaway #1
Debugging is a problem of scarcity
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Let’s do an exercise:
- Search on Google “Learn to Program”
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Let’s do an exercise:
- Search on Google “Learn to Program”
- 1,540,000,000 Results (1.5 Billion results)
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Let’s do another exercise:
- Search on Google “Implement an
ordered List”
- 3,020,000 Results
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Let’s do another exercise:
- Search on Google “Ordered Hash Table”
- 758,000 Results
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
The more advanced your question is,
the less easy answers you will find
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Do you remember your first time?
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Do you remember your first time?
print “Hello world”
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Do you remember your first CRUD App?
Your first blog?, your first to do list?
What do they have in common?
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Do you remember your first CRUD App?
Your first blog?, your first to do list?
What do they have in common?
You knew the whole App!!!
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
This is what it feels like working on a new,
different and legacy codebase ...
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
The difference between a good developer
and a bad developer is understanding.
Why is debugging hard?
Barcamp 2015, Santiago, R.D.
The difference between a good developer
and a bad developer is understanding.
Understanding of what does not change.
Know yourself
Barcamp 2015, Santiago, R.D.
Do you understand the basics of your
(Language/Library/framework) or you just
did a tutorial?
Know yourself
Barcamp 2015, Santiago, R.D.
Do you read the documentation while
learning the technology or after something’s
break?
Know yourself
Barcamp 2015, Santiago, R.D.
Do you know the standard library well or
you just copy/paste from stack overflow?
Know yourself
Barcamp 2016, Santiago, R.D.
Know yourself (example)
Barcamp 2015, Santiago, R.D.
def is_equal(a, b):
return a is b
>> is_equal(2, 2)
True
>> is_equal(4, 3)
False
Know yourself (example)
Barcamp 2015, Santiago, R.D.
def is_equal(a, b):
return a is b
>> value = 256
>> is_equal(256, value)
?
Know yourself (example)
Barcamp 2015, Santiago, R.D.
def is_equal(a, b):
return a is b
>> value = 256
>> is_equal(256, value)
True
Know yourself (example)
Barcamp 2015, Santiago, R.D.
def is_equal(a, b):
return a is b
>> value = 257
>> is_equal(257, value)
?
Know yourself (example)
Barcamp 2015, Santiago, R.D.
def is_equal(a, b):
return a is b
>> value = 257
>> is_equal(257, value)
False
Know yourself (example)
Barcamp 2015, Santiago, R.D.
def is_equal(a, b):
return a is b
Why???
Know yourself (example)
Barcamp 2015, Santiago, R.D.
def is_equal(a, b):
return a is b
Equality is different to Identity
In General
Barcamp 2015, Santiago, R.D.
Key Takeaway #2
The code can give you the right result for
the wrong reasons.
Know yourself (example)
Barcamp 2015, Santiago, R.D.
Ruby Example
Know yourself (example)
Barcamp 2015, Santiago, R.D.
class Bicycle
attr_reader :size, :parts
def initialize(args={})
@size = args[:size]
@parts = args[:parts]
end
def spares
parts.spares
end
end
Know yourself (example)
Barcamp 2015, Santiago, R.D.
class Parts < Array
def size
parts.size
end
end
Know yourself (example)
Barcamp 2015, Santiago, R.D.
class Part
attr_reader :name, :description, :needs_space
def initialize(args)
@name = args[:name]
@description = args[:description]
@needs_spare = args.fetch(:needs_spare, true)
end
end
Know yourself (example)
Barcamp 2015, Santiago, R.D.
# Individual Parts
chain = Part.new(name: 'chain', description: '10-speed')
road_tire = Part.new(name: 'tire_size', description: '23')
tape = Part.new(name: 'tape_color', description: 'red')
mountain_tire = Part.new(name: 'tire_size', description: '2.1')
rear_shock = Part.new(name: 'rear_shock', description: 'Fox')
front_shock = Part.new(
name: 'front_shock',
description: 'Manitou',
needs_spare: false)
Know yourself (example)
Barcamp 2015, Santiago, R.D.
# Parts Objects
road_bike_parts = Parts.new([chain, road_tire, tape])
mountain_bike_parts = Parts.new([chain, mountain_tire,
front_shock, rear_shock])
Know yourself (example)
Barcamp 2015, Santiago, R.D.
# Bicycle Objects
road_bike = Bicycle.new(size: ‘L’, parts: road_bike_parts)
mountain_bike = Bicycle.new(size: ‘L’, parts:
mountain_bike_parts)
Know yourself (example)
Barcamp 2015, Santiago, R.D.
# Property Tests
mountain_bike .size # - > ‘L’
mountain_bike.spares
# - > [#<Part:0x00000101036770
# @name="chain",
# @description="10-speed",
# @needs_spare=true>,
# #<Part:0x0000010101b678
# @name="tire_size",
# etc ...
Know yourself (example)
Barcamp 2015, Santiago, R.D.
# Property Tests
combo_parts =
(mountain_bike.parts + road_bike.parts)
combo_parts.size # - > 7
combo_parts.spares
# - > NoMethodError: undefined method 'spares'
# for #<Array:...>
Know yourself (example)
Barcamp 2015, Santiago, R.D.
# Property Tests
combo_parts =
(mountain_bike.parts + road_bike.parts)
combo_parts.size # - > 7
combo_parts.spares
# - > NoMethodError: undefined method 'spares'
# for #<Array:...>
Why?
In General
Barcamp 2015, Santiago, R.D.
The code can give you the right result for
the wrong reasons.
The True Path to Debugging
Barcamp 2015, Santiago, R.D.
The True Path to Debugging
Barcamp 2016, Santiago, R.D.
In General
Barcamp 2015, Santiago, R.D.
Key Takeaway #3
Growing as a software developer means
moving from memorisation to understanding
In General
Barcamp 2015, Santiago, R.D.
Key Takeaway #4
Avoid shotgun surgery become a neurosurgeon.
The True Path to Debugging
Barcamp 2015, Santiago, R.D.
- Know Yourself tools
- Search within your code
- Be one with the universe person who asks
The True Path to Debugging
Barcamp 2015, Santiago, R.D.
(You can Name it)
ARE
TOOLS
The True Path to Debugging
Barcamp 2015, Santiago, R.D.
LEARN:
- When to use it and when not
- Learn Many and avoid a lot more
- One really well
- Learn the principles
In General
Barcamp 2015, Santiago, R.D.
Key Takeaway #5
Debugging is not a tool, is a mindset.
The mindset name is curiosity.
Be Curious.
The True Path to Debugging
Barcamp 2015, Santiago, R.D.
READ THE $#%@$%# MANUAL:
- Read the documentation
- Read the specifications
- Read the code (yes, for Fun)
The True Path to Debugging
Barcamp 2015, Santiago, R.D.
If Nothing else works ask, but:
- Make sure you read the documentation
- Make your homework
- Tried to solve it yourself
The True Path to Debugging
Barcamp 2015, Santiago, R.D.
When asking:
- Be respectful
- Tell the facts not your theories
- Don’t be proud
Debugging Rules
Barcamp 2015, Santiago, R.D.
- Understand the system
- Make it Fail
- Quit Thinking and look
- Divide and conquer
- Change one thing at a time
- Keep up an audit trail
- Check if it is on
- Talk with another person
- If you don't fix it, it ain't fixed
Remember?
Barcamp 2015, Santiago, R.D.
Do you remember the definition of Debugging?
What is debugging?
Barcamp 2015, Santiago, R.D.
My (really recent definition) Definition
“Debugging is the process of finding and resolving bugs or
defects in the code in a manner that the code is better than
the way it was found”
Remember?
Barcamp 2015, Santiago, R.D.
Does every interaction with your code making it better?
Remember?
Barcamp 2015, Santiago, R.D.
Or do you sing ?
99 little bugs in the code
99 little bugs in the code
Take one down, patch it around
117 little bugs in the code
In General
Barcamp 2015, Santiago, R.D.
Key Takeaway #6
In order to be an amazing debugger you
should be an incredible refactorer.
In the end
- Don’t rush
- Don’t Panic
- Understand the problem
- Understand your Language
- Understand your tools
- RTFM
In General
Barcamp 2015, Santiago, R.D.
Preguntas??
Debugging para el no iniciado:
Barcamp 2015, Santiago, R.D.
Barcamp 2015, Santiago, R.D.
Gracias !!
Blog: www.leonardo.do
correo: leonardo@codetiger.co
twitter: @leonardoajim
De Frustrado a Competente
Debugging para el no iniciado:
Barcamp 2015, Santiago, R.D.

Contenu connexe

En vedette

N.e.m.o. albert serrat
N.e.m.o. albert serratN.e.m.o. albert serrat
N.e.m.o. albert serrat
emallol1
 
Presentazione standard1
Presentazione standard1Presentazione standard1
Presentazione standard1
VivianaaF
 
Capitalizing on OTT Breakfast Forum-Heavy Reading for posting
Capitalizing on OTT Breakfast Forum-Heavy Reading for postingCapitalizing on OTT Breakfast Forum-Heavy Reading for posting
Capitalizing on OTT Breakfast Forum-Heavy Reading for posting
Verimatrix
 
Aim natural stone_market survey_2010_eng__sample_short
Aim natural stone_market survey_2010_eng__sample_shortAim natural stone_market survey_2010_eng__sample_short
Aim natural stone_market survey_2010_eng__sample_short
Agency of Industrial Marketing
 
Unitats electriques
Unitats electriquesUnitats electriques
Unitats electriques
Avel·lí
 

En vedette (15)

N.e.m.o. albert serrat
N.e.m.o. albert serratN.e.m.o. albert serrat
N.e.m.o. albert serrat
 
JavaOne Brazil 2010 na revista Espírito Livre
JavaOne Brazil 2010 na revista Espírito LivreJavaOne Brazil 2010 na revista Espírito Livre
JavaOne Brazil 2010 na revista Espírito Livre
 
Presentazione standard1
Presentazione standard1Presentazione standard1
Presentazione standard1
 
Pós Ruy - 2 e 3 Camadas - Arquitetura em camadas
Pós Ruy - 2 e 3 Camadas - Arquitetura em camadasPós Ruy - 2 e 3 Camadas - Arquitetura em camadas
Pós Ruy - 2 e 3 Camadas - Arquitetura em camadas
 
Capitalizing on OTT Breakfast Forum-Heavy Reading for posting
Capitalizing on OTT Breakfast Forum-Heavy Reading for postingCapitalizing on OTT Breakfast Forum-Heavy Reading for posting
Capitalizing on OTT Breakfast Forum-Heavy Reading for posting
 
Aim natural stone_market survey_2010_eng__sample_short
Aim natural stone_market survey_2010_eng__sample_shortAim natural stone_market survey_2010_eng__sample_short
Aim natural stone_market survey_2010_eng__sample_short
 
Multi-network Solutions in the Real World, CABSAT: Steve Oetegenn, Verimatrix
Multi-network Solutions in the Real World, CABSAT: Steve Oetegenn, VerimatrixMulti-network Solutions in the Real World, CABSAT: Steve Oetegenn, Verimatrix
Multi-network Solutions in the Real World, CABSAT: Steve Oetegenn, Verimatrix
 
Presentacio sedeib gestib
Presentacio sedeib gestibPresentacio sedeib gestib
Presentacio sedeib gestib
 
sytay
sytaysytay
sytay
 
Estructures
EstructuresEstructures
Estructures
 
Unitats electriques
Unitats electriquesUnitats electriques
Unitats electriques
 
Where and how to start a solid lean transformation
Where and how to start a solid lean transformationWhere and how to start a solid lean transformation
Where and how to start a solid lean transformation
 
Ch 5 Motivation
Ch 5 MotivationCh 5 Motivation
Ch 5 Motivation
 
yurkevich
yurkevichyurkevich
yurkevich
 
General market info
General market infoGeneral market info
General market info
 

Similaire à Debugging para el no iniciado

Pretotyping g motta agile brazil 2013
Pretotyping g motta agile brazil 2013Pretotyping g motta agile brazil 2013
Pretotyping g motta agile brazil 2013
Guilherme Motta
 

Similaire à Debugging para el no iniciado (20)

Oi Conf Bristol 2018 - Think "customer first" in your digital marketing strat...
Oi Conf Bristol 2018 - Think "customer first" in your digital marketing strat...Oi Conf Bristol 2018 - Think "customer first" in your digital marketing strat...
Oi Conf Bristol 2018 - Think "customer first" in your digital marketing strat...
 
Good dev citizen
Good dev citizenGood dev citizen
Good dev citizen
 
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
Building a Beer Recommender with Yhat (PAPIs.io - November 2014)
 
Less Programmatic Jargon, More Programmatic Action - Carrie Albright #UtahDMC...
Less Programmatic Jargon, More Programmatic Action - Carrie Albright #UtahDMC...Less Programmatic Jargon, More Programmatic Action - Carrie Albright #UtahDMC...
Less Programmatic Jargon, More Programmatic Action - Carrie Albright #UtahDMC...
 
Do you really need a Child Theme?
Do you really need a Child Theme?Do you really need a Child Theme?
Do you really need a Child Theme?
 
CICON2010: Kevin Smith - CodeIgniter in Production
CICON2010: Kevin Smith - CodeIgniter in ProductionCICON2010: Kevin Smith - CodeIgniter in Production
CICON2010: Kevin Smith - CodeIgniter in Production
 
Code kata
Code kataCode kata
Code kata
 
Refactor your specs! Øredev 2013
Refactor your specs! Øredev 2013Refactor your specs! Øredev 2013
Refactor your specs! Øredev 2013
 
4Developers: Ryszard Skonieczka- Pokaż kotku, co masz w środku - czyli jak wy...
4Developers: Ryszard Skonieczka- Pokaż kotku, co masz w środku - czyli jak wy...4Developers: Ryszard Skonieczka- Pokaż kotku, co masz w środku - czyli jak wy...
4Developers: Ryszard Skonieczka- Pokaż kotku, co masz w środku - czyli jak wy...
 
Applied Data Science: Building a Beer Recommender | Data Science MD - Oct 2014
Applied Data Science: Building a Beer Recommender | Data Science MD - Oct 2014Applied Data Science: Building a Beer Recommender | Data Science MD - Oct 2014
Applied Data Science: Building a Beer Recommender | Data Science MD - Oct 2014
 
Pretotyping g motta agile brazil 2013
Pretotyping g motta agile brazil 2013Pretotyping g motta agile brazil 2013
Pretotyping g motta agile brazil 2013
 
AI Tools for Business and Startups
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and Startups
 
resolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bddresolvendo problemas de comunicação em equipes distribuídas com bdd
resolvendo problemas de comunicação em equipes distribuídas com bdd
 
Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...
 
Tienda Development Workshop - JAB11
Tienda Development Workshop - JAB11Tienda Development Workshop - JAB11
Tienda Development Workshop - JAB11
 
Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-9-431 (1)
Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-9-431 (1)Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-9-431 (1)
Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-9-431 (1)
 
Grails Worst Practices
Grails Worst PracticesGrails Worst Practices
Grails Worst Practices
 
APIdays Barcelona 2019 - Competing with an API giant, lessons learned with Ed...
APIdays Barcelona 2019 - Competing with an API giant, lessons learned with Ed...APIdays Barcelona 2019 - Competing with an API giant, lessons learned with Ed...
APIdays Barcelona 2019 - Competing with an API giant, lessons learned with Ed...
 
Competing with an API giant, lessons learned: OpenCage vs. Google
Competing with an API giant, lessons learned: OpenCage vs. GoogleCompeting with an API giant, lessons learned: OpenCage vs. Google
Competing with an API giant, lessons learned: OpenCage vs. Google
 
Inbound Growth for SaaS Scale-Ups #INBOUND18
Inbound Growth for SaaS Scale-Ups #INBOUND18Inbound Growth for SaaS Scale-Ups #INBOUND18
Inbound Growth for SaaS Scale-Ups #INBOUND18
 

Plus de Leonardo Jimenez (9)

How to create developer communities
How to create developer communitiesHow to create developer communities
How to create developer communities
 
Pyladies Workshop (Spanish)
Pyladies Workshop (Spanish)Pyladies Workshop (Spanish)
Pyladies Workshop (Spanish)
 
Python for Dummies
Python for DummiesPython for Dummies
Python for Dummies
 
Python Testing 101 with Selenium
Python Testing 101 with SeleniumPython Testing 101 with Selenium
Python Testing 101 with Selenium
 
Lean startup 101
Lean startup 101Lean startup 101
Lean startup 101
 
Presentación comunidades python dominicana
Presentación comunidades python dominicanaPresentación comunidades python dominicana
Presentación comunidades python dominicana
 
The age of entrepreneurship
The age of entrepreneurshipThe age of entrepreneurship
The age of entrepreneurship
 
Startups 101
Startups 101Startups 101
Startups 101
 
Genetica Mutaciones
Genetica MutacionesGenetica Mutaciones
Genetica Mutaciones
 

Dernier

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Dernier (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 

Debugging para el no iniciado

  • 1. De Frustrado a Competente Debugging para el no iniciado: Barcamp 2015, Santiago, R.D.
  • 2. What we will cover Barcamp 2015, Santiago, R.D. - What is debugging - Why is hard - Know yourself - The true path to debugging - The rules of debugging - What debugging displays - Remember
  • 3. About me Barcamp 2015, Santiago, R.D. Leonardo Jimenez (Un entusiasta del software) Blog: www.leonardo.do correo: leonardo@codetiger.co Co-Founder and Developer @Codetiger We love Python, We use a ton of stuff One of the organizers of @pythondo && @Jsdo
  • 5. Can you tell me what debugging means to you? What is debugging? Barcamp 2015, Santiago, R.D.
  • 6. What is debugging? Barcamp 2015, Santiago, R.D. Can you tell me what debugging means to you? Some frequent answers: - Make the error go away - Eliminate the errors on the screen - “Resolver…!”
  • 7. What is debugging? Barcamp 2015, Santiago, R.D. Most of the answers are related to fixing the actual problem ...
  • 8. What is debugging? Barcamp 2015, Santiago, R.D. My (really recent definition) Definition “Debugging is the process of finding and resolving bugs or defects in the code in a manner that the code is better than the way it was found”
  • 9. What is debugging? Barcamp 2015, Santiago, R.D. Debugging Normally includes: 1. Get the bug in the database (if you are lucky) 2. Reproduce the problem 3. Automate and simplify the test case (if you know what you are doing) 4. Find possible infection origins 5. Focus on the most likely origins 6. Isolate the infection chain 7. Correct the defect
  • 10. What is debugging? Barcamp 2015, Santiago, R.D. Debugging Normally includes: 1. Get the bug in the database (if you are lucky) 2. Reproduce the problem 3. Automate and simplify the test case (if you know what you are doing) 4. Find possible infection origins 5. Focus on the most likely origins 6. Isolate the infection chain 7. Correct the defect { Understand the Problem
  • 11. What is debugging? Barcamp 2015, Santiago, R.D. Debugging Normally includes: 1. Get the bug in the database (if you are lucky) 2. Reproduce the problem 3. Automate and simplify the test case (if you know what you are doing) 4. Find possible infection origins 5. Focus on the most likely origins 6. Isolate the infection chain 7. Correct the defect { Search the Problem
  • 12. What is debugging? Barcamp 2015, Santiago, R.D. Debugging Normally includes: 1. Get the bug in the database (if you are lucky) 2. Reproduce the problem 3. Automate and simplify the test case (if you know what you are doing) 4. Find possible infection origins 5. Focus on the most likely origins 6. Isolate the infection chain 7. Correct the defect{ Fixing it
  • 13. What is debugging? Barcamp 2015, Santiago, R.D. Debugging Normally includes: 1. Get the bug in the database (if you are lucky) 2. Reproduce the problem 3. Automate and simplify the test case (if you know what you are doing) 4. Find possible infection origins 5. Focus on the most likely origins 6. Isolate the infection chain 7. Correct the defect { Most of your time goes here
  • 14. Why is debugging hard? Barcamp 2015, Santiago, R.D. Key Takeaway #1 Debugging is a problem of scarcity
  • 15. Why is debugging hard? Barcamp 2015, Santiago, R.D. Let’s do an exercise: - Search on Google “Learn to Program”
  • 16. Why is debugging hard? Barcamp 2015, Santiago, R.D. Let’s do an exercise: - Search on Google “Learn to Program” - 1,540,000,000 Results (1.5 Billion results)
  • 17. Why is debugging hard? Barcamp 2015, Santiago, R.D. Let’s do another exercise: - Search on Google “Implement an ordered List” - 3,020,000 Results
  • 18. Why is debugging hard? Barcamp 2015, Santiago, R.D. Let’s do another exercise: - Search on Google “Ordered Hash Table” - 758,000 Results
  • 19. Why is debugging hard? Barcamp 2015, Santiago, R.D. The more advanced your question is, the less easy answers you will find
  • 20. Why is debugging hard? Barcamp 2015, Santiago, R.D. Do you remember your first time?
  • 21. Why is debugging hard? Barcamp 2015, Santiago, R.D. Do you remember your first time? print “Hello world”
  • 22. Why is debugging hard? Barcamp 2015, Santiago, R.D. Do you remember your first CRUD App? Your first blog?, your first to do list? What do they have in common?
  • 23. Why is debugging hard? Barcamp 2015, Santiago, R.D. Do you remember your first CRUD App? Your first blog?, your first to do list? What do they have in common? You knew the whole App!!!
  • 24. Why is debugging hard? Barcamp 2015, Santiago, R.D. This is what it feels like working on a new, different and legacy codebase ...
  • 25. Why is debugging hard? Barcamp 2015, Santiago, R.D.
  • 26. Why is debugging hard? Barcamp 2015, Santiago, R.D. The difference between a good developer and a bad developer is understanding.
  • 27. Why is debugging hard? Barcamp 2015, Santiago, R.D. The difference between a good developer and a bad developer is understanding. Understanding of what does not change.
  • 28. Know yourself Barcamp 2015, Santiago, R.D. Do you understand the basics of your (Language/Library/framework) or you just did a tutorial?
  • 29. Know yourself Barcamp 2015, Santiago, R.D. Do you read the documentation while learning the technology or after something’s break?
  • 30. Know yourself Barcamp 2015, Santiago, R.D. Do you know the standard library well or you just copy/paste from stack overflow?
  • 31. Know yourself Barcamp 2016, Santiago, R.D.
  • 32. Know yourself (example) Barcamp 2015, Santiago, R.D. def is_equal(a, b): return a is b >> is_equal(2, 2) True >> is_equal(4, 3) False
  • 33. Know yourself (example) Barcamp 2015, Santiago, R.D. def is_equal(a, b): return a is b >> value = 256 >> is_equal(256, value) ?
  • 34. Know yourself (example) Barcamp 2015, Santiago, R.D. def is_equal(a, b): return a is b >> value = 256 >> is_equal(256, value) True
  • 35. Know yourself (example) Barcamp 2015, Santiago, R.D. def is_equal(a, b): return a is b >> value = 257 >> is_equal(257, value) ?
  • 36. Know yourself (example) Barcamp 2015, Santiago, R.D. def is_equal(a, b): return a is b >> value = 257 >> is_equal(257, value) False
  • 37. Know yourself (example) Barcamp 2015, Santiago, R.D. def is_equal(a, b): return a is b Why???
  • 38. Know yourself (example) Barcamp 2015, Santiago, R.D. def is_equal(a, b): return a is b Equality is different to Identity
  • 39. In General Barcamp 2015, Santiago, R.D. Key Takeaway #2 The code can give you the right result for the wrong reasons.
  • 40. Know yourself (example) Barcamp 2015, Santiago, R.D. Ruby Example
  • 41. Know yourself (example) Barcamp 2015, Santiago, R.D. class Bicycle attr_reader :size, :parts def initialize(args={}) @size = args[:size] @parts = args[:parts] end def spares parts.spares end end
  • 42. Know yourself (example) Barcamp 2015, Santiago, R.D. class Parts < Array def size parts.size end end
  • 43. Know yourself (example) Barcamp 2015, Santiago, R.D. class Part attr_reader :name, :description, :needs_space def initialize(args) @name = args[:name] @description = args[:description] @needs_spare = args.fetch(:needs_spare, true) end end
  • 44. Know yourself (example) Barcamp 2015, Santiago, R.D. # Individual Parts chain = Part.new(name: 'chain', description: '10-speed') road_tire = Part.new(name: 'tire_size', description: '23') tape = Part.new(name: 'tape_color', description: 'red') mountain_tire = Part.new(name: 'tire_size', description: '2.1') rear_shock = Part.new(name: 'rear_shock', description: 'Fox') front_shock = Part.new( name: 'front_shock', description: 'Manitou', needs_spare: false)
  • 45. Know yourself (example) Barcamp 2015, Santiago, R.D. # Parts Objects road_bike_parts = Parts.new([chain, road_tire, tape]) mountain_bike_parts = Parts.new([chain, mountain_tire, front_shock, rear_shock])
  • 46. Know yourself (example) Barcamp 2015, Santiago, R.D. # Bicycle Objects road_bike = Bicycle.new(size: ‘L’, parts: road_bike_parts) mountain_bike = Bicycle.new(size: ‘L’, parts: mountain_bike_parts)
  • 47. Know yourself (example) Barcamp 2015, Santiago, R.D. # Property Tests mountain_bike .size # - > ‘L’ mountain_bike.spares # - > [#<Part:0x00000101036770 # @name="chain", # @description="10-speed", # @needs_spare=true>, # #<Part:0x0000010101b678 # @name="tire_size", # etc ...
  • 48. Know yourself (example) Barcamp 2015, Santiago, R.D. # Property Tests combo_parts = (mountain_bike.parts + road_bike.parts) combo_parts.size # - > 7 combo_parts.spares # - > NoMethodError: undefined method 'spares' # for #<Array:...>
  • 49. Know yourself (example) Barcamp 2015, Santiago, R.D. # Property Tests combo_parts = (mountain_bike.parts + road_bike.parts) combo_parts.size # - > 7 combo_parts.spares # - > NoMethodError: undefined method 'spares' # for #<Array:...> Why?
  • 50. In General Barcamp 2015, Santiago, R.D. The code can give you the right result for the wrong reasons.
  • 51. The True Path to Debugging Barcamp 2015, Santiago, R.D.
  • 52. The True Path to Debugging Barcamp 2016, Santiago, R.D.
  • 53. In General Barcamp 2015, Santiago, R.D. Key Takeaway #3 Growing as a software developer means moving from memorisation to understanding
  • 54. In General Barcamp 2015, Santiago, R.D. Key Takeaway #4 Avoid shotgun surgery become a neurosurgeon.
  • 55. The True Path to Debugging Barcamp 2015, Santiago, R.D. - Know Yourself tools - Search within your code - Be one with the universe person who asks
  • 56. The True Path to Debugging Barcamp 2015, Santiago, R.D. (You can Name it) ARE TOOLS
  • 57. The True Path to Debugging Barcamp 2015, Santiago, R.D. LEARN: - When to use it and when not - Learn Many and avoid a lot more - One really well - Learn the principles
  • 58. In General Barcamp 2015, Santiago, R.D. Key Takeaway #5 Debugging is not a tool, is a mindset. The mindset name is curiosity. Be Curious.
  • 59. The True Path to Debugging Barcamp 2015, Santiago, R.D. READ THE $#%@$%# MANUAL: - Read the documentation - Read the specifications - Read the code (yes, for Fun)
  • 60. The True Path to Debugging Barcamp 2015, Santiago, R.D. If Nothing else works ask, but: - Make sure you read the documentation - Make your homework - Tried to solve it yourself
  • 61. The True Path to Debugging Barcamp 2015, Santiago, R.D. When asking: - Be respectful - Tell the facts not your theories - Don’t be proud
  • 62. Debugging Rules Barcamp 2015, Santiago, R.D. - Understand the system - Make it Fail - Quit Thinking and look - Divide and conquer - Change one thing at a time - Keep up an audit trail - Check if it is on - Talk with another person - If you don't fix it, it ain't fixed
  • 63. Remember? Barcamp 2015, Santiago, R.D. Do you remember the definition of Debugging?
  • 64. What is debugging? Barcamp 2015, Santiago, R.D. My (really recent definition) Definition “Debugging is the process of finding and resolving bugs or defects in the code in a manner that the code is better than the way it was found”
  • 65. Remember? Barcamp 2015, Santiago, R.D. Does every interaction with your code making it better?
  • 66. Remember? Barcamp 2015, Santiago, R.D. Or do you sing ? 99 little bugs in the code 99 little bugs in the code Take one down, patch it around 117 little bugs in the code
  • 67. In General Barcamp 2015, Santiago, R.D. Key Takeaway #6 In order to be an amazing debugger you should be an incredible refactorer.
  • 68. In the end - Don’t rush - Don’t Panic - Understand the problem - Understand your Language - Understand your tools - RTFM In General Barcamp 2015, Santiago, R.D.
  • 69. Preguntas?? Debugging para el no iniciado: Barcamp 2015, Santiago, R.D.
  • 70. Barcamp 2015, Santiago, R.D. Gracias !! Blog: www.leonardo.do correo: leonardo@codetiger.co twitter: @leonardoajim
  • 71. De Frustrado a Competente Debugging para el no iniciado: Barcamp 2015, Santiago, R.D.