SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
Bug Hunting Safari!
Janie Clayton-Hasz
Why is Debugging Hard?
• We all know we should debug, but many people
don’t know how to do it well.
• Our community does not have an overly broad
knowledge base about doing in-depth debugging
because it’s hard to make time to learn it better.
• We like to think that we can write all of our code
perfectly without any mistakes, but unfortunately
that is not the case, no matter how hard we try.
– Crow T. Robot from Mystery Science Theater 3000 for those under the age
of thirty or over the age of fifty
“Well, believe me, Mike, I calculated
the odds of this succeeding versus
the odds I was doing something
incredibly stupid… and I went
ahead anyway…”
Why is Learning Efficient
Debugging Important?
• Depending on the source, it is reported that a
professional programmer spends only 1/6 of their
time coding. Most sources agree that half of your
time as a programmer will be spent debugging
yours and other people’s code.
• Learning tools, tricks, and common problems will
free up more of your time so you can code rather
than debug!
Why is Learning Efficient
Debugging Important?
• At some point in your career, you will be working on
code that you did not write yourself. The previous
person will do things differently than you would
have and you need to be able to figure out why
something you did not write works and breaks.
• You will continue to grow and mature as a
developer. Looking at code you did three months
ago can be painful and you probably won’t
remember what you did or why.
Setting up Your
Debugging Environment
Why Have a Debugging
Environment??
• Everything you do in work and in life is better when
you have a dedicated set-up for it. Look at your
kitchen. You have a dedicated space to doing a
specific task and everything is arranged to make
that as easy as possible
• You have, or should have, a dedicated coding
space to help you focus and be productive. If you
want to be a productive debugger, you need to
care about setting up your space and your tools.
Debugging Console
• Create a dedicated debugging tab
• Make sure your bottom view is exposed
• Can set many things to optimize debugging in
XcodePreferencesBehaviors
NSLog(): First Line of
Defense!
NSLog()
• NSLog() is a function that you can use to print a
message to your console.
• NSLog() is a development tool. Nothing printed
using NSLog() is seen by the user
• Usually used to print out variables to the console in
order to check their value and to ensure they are set
• First type of debugging most people learn how to
do
Breakpoints!
Thing I accidentally make
when I click on an error
message that makes my
program stop running.
Flavors of Breakpoints
• Breakpoint Logging
• Exception Breakpoints
• Conditional Breakpoints
• Symbolic Breakpoints
• Watchpoints
Advantages of Breakpoints
• Easier to clear out of production code than NSLog()
statements. You should not include NSLog()
statements in an app that is submitted to the App
Store
• More flexible than adding code to your project for
debugging
• Less likely to generate errors because you are not
adding additional code to your project
Breakpoint Logging
Logging with Breakpoints
• Think back to when you were creating all those
NSLog() statements. They were kind of messy,
weren’t they?
• You can use breakpoints to do the same thing
Exception Breakpoint
When Do You Use an
Exception Breakpoint?
• Have you ever built and run your application only to
have it crash and direct you to the Main.m file? You
know the problem isn’t there because you haven’t
touched it. How do you find out where the problem
actually is?
• You use an Exception Breakpoint
Exception Breakpoint
• What happens with Xcode is that when it
encounters a problem in your code, it will keep
going until it crashes. That is why it usually stops in
the incredibly unhelpful Main.m class rather than
where the problem actually is.
• By creating an exception breakpoint, you are telling
Xcode you want it to stop where the problem is
rather than to keep going and crash somewhere
else.
Conditional Breakpoints
Conditional Breakpoint
• You are telling Xcode to stop if a condition is not
met.
• The condition must equate down to a true or a
false.
• You can use this in a loop if you need to know what
the result of a certain iteration is by setting “Ignore
’n’ times before stopping.”
Watchpoint
Who Watches the
Watchpoints?
• Watchpoints are a tool you can use to keep an eye
on any object that is going to undergo a change.
• For example, if you have a label that is updated by
input from the user, you can set a watchpoint on it.
Symbolic Breakpoint
Symbolic Breakpoints
• Used any time a specific method type is called.
• For example, if you want to know every time the
view loads you can create a symbolic breakpoint to
do something when viewDidLoad is called.
LLDB: Or How I
Stopped Worrying and
Learned to Love the
Command Line
What is LLDB?
• All of the tools we have been working with so far
are written in LLDB.
• LLDB uses a command line interface.
• Anything you did in Xcode, like setting a
breakpoint, can be done on the command line in
the debugging console.
Why Would I Want to Know
LLDB?
• LLDB has more functionality than what has been
built into the user interface in Xcode.
• Writing code in the command line is faster and
more efficient than having to use the mouse to
move around selecting user interface elements.
• You can do debugging in the terminal and bypass
Xcode completely. If you want to use something
like AppCode, this is a way to use LLDB.
Why Would I Want to Know
LLDB?
• You can customize LLDB commands to suit your
projects more closely
• You can extend LLDB’s functionality with the use of
Python Scripts
Creative Way to Torture
Your Coworkers
Sound Breakpoints!!
• You can program a breakpoint to generate a sound
when something happens.
• When you go on vacation, program all of your
breakpoints to make annoying sounds when the
program is running. Your less knowledgeable
coworkers will go crazy figuring out where the
sound is coming from!! BWHAHAHA!!!
In Conclusion…
99 little bugs in the code!
99 little bugs!
You take one down,
You patch it around!
117 little bugs in the code!
Bugs are bad. You do not want bugs. You do
not want to ship an app that has bugs. Bugs
are the number one reason that apps are
rejected from the App Store.
!
Bugs happen. You don’t want to ignore little
bugs…
Because they become
BIG BUGS!!
`

Weitere ähnliche Inhalte

Was ist angesagt?

Most valuable software design principles
Most valuable software design principlesMost valuable software design principles
Most valuable software design principlesJeroen Hildering
 
iOS Automated Testing with Calabash: Tips and Tricks
iOS Automated Testing with Calabash: Tips and TricksiOS Automated Testing with Calabash: Tips and Tricks
iOS Automated Testing with Calabash: Tips and Tricksmobiletestsummit
 
Code smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsCode smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsClint Edmonson
 
Front end and back end storyboarding
Front end and back end storyboardingFront end and back end storyboarding
Front end and back end storyboardingJudd Slivka
 
Two heads are better: the benefits of pair writing
Two heads are better: the benefits of pair writingTwo heads are better: the benefits of pair writing
Two heads are better: the benefits of pair writingJulie Threlkeld
 
AATC2016: Exploratory testing an API
AATC2016: Exploratory testing an APIAATC2016: Exploratory testing an API
AATC2016: Exploratory testing an APIMaaret Pyhäjärvi
 
Terminal Happiness
Terminal HappinessTerminal Happiness
Terminal HappinessLiam Dempsey
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
7 things to sabotage an agile coach camp
7 things to sabotage an agile coach camp7 things to sabotage an agile coach camp
7 things to sabotage an agile coach campMarc Löffler
 

Was ist angesagt? (14)

Pp informatica
Pp informaticaPp informatica
Pp informatica
 
Lecture 31
Lecture 31Lecture 31
Lecture 31
 
Most valuable software design principles
Most valuable software design principlesMost valuable software design principles
Most valuable software design principles
 
iOS Automated Testing with Calabash: Tips and Tricks
iOS Automated Testing with Calabash: Tips and TricksiOS Automated Testing with Calabash: Tips and Tricks
iOS Automated Testing with Calabash: Tips and Tricks
 
Code smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsCode smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software Odors
 
A UX Manifesto
A UX ManifestoA UX Manifesto
A UX Manifesto
 
Programming
ProgrammingProgramming
Programming
 
Front end and back end storyboarding
Front end and back end storyboardingFront end and back end storyboarding
Front end and back end storyboarding
 
Lecture 30
Lecture 30Lecture 30
Lecture 30
 
Two heads are better: the benefits of pair writing
Two heads are better: the benefits of pair writingTwo heads are better: the benefits of pair writing
Two heads are better: the benefits of pair writing
 
AATC2016: Exploratory testing an API
AATC2016: Exploratory testing an APIAATC2016: Exploratory testing an API
AATC2016: Exploratory testing an API
 
Terminal Happiness
Terminal HappinessTerminal Happiness
Terminal Happiness
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
7 things to sabotage an agile coach camp
7 things to sabotage an agile coach camp7 things to sabotage an agile coach camp
7 things to sabotage an agile coach camp
 

Ähnlich wie Bug Hunting Safari

Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential SkillsJohn Choi
 
Developers Best Practices
Developers Best PracticesDevelopers Best Practices
Developers Best Practicesaqib javaid
 
Software Development Whats & Whys
Software Development Whats & Whys Software Development Whats & Whys
Software Development Whats & Whys Harun Yardımcı
 
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 byYe Win
 
CNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbgCNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbgSam Bowne
 
Things You Need to Know Before Starting An App-Openair2015 keynote
Things You Need to Know Before Starting An App-Openair2015 keynoteThings You Need to Know Before Starting An App-Openair2015 keynote
Things You Need to Know Before Starting An App-Openair2015 keynoteSana Nasar
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assuranceBenjamin Baumann
 
Prototyping Accessibility - WordCamp Europe 2018
Prototyping Accessibility - WordCamp Europe 2018Prototyping Accessibility - WordCamp Europe 2018
Prototyping Accessibility - WordCamp Europe 2018Adrian Roselli
 
The Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with androidThe Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with androidStanojko Markovik
 
Computer programming
Computer programmingComputer programming
Computer programmingSujay Raj
 
Practical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgPractical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgSam Bowne
 
Preparing for the WebGeek DevCup
Preparing for the WebGeek DevCupPreparing for the WebGeek DevCup
Preparing for the WebGeek DevCupbryanbibat
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 
Getting better through Katas
Getting better through KatasGetting better through Katas
Getting better through KatasNola Stowe
 

Ähnlich wie Bug Hunting Safari (20)

PHP - Introduction to PHP Bugs - Debugging
PHP -  Introduction to  PHP Bugs - DebuggingPHP -  Introduction to  PHP Bugs - Debugging
PHP - Introduction to PHP Bugs - Debugging
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential Skills
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Developers Best Practices
Developers Best PracticesDevelopers Best Practices
Developers Best Practices
 
Software Development Whats & Whys
Software Development Whats & Whys Software Development Whats & Whys
Software Development Whats & Whys
 
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
 
CNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbgCNIT 126 Ch 9: OllyDbg
CNIT 126 Ch 9: OllyDbg
 
Traits of a Good Engineer
Traits of a Good EngineerTraits of a Good Engineer
Traits of a Good Engineer
 
Things You Need to Know Before Starting An App-Openair2015 keynote
Things You Need to Know Before Starting An App-Openair2015 keynoteThings You Need to Know Before Starting An App-Openair2015 keynote
Things You Need to Know Before Starting An App-Openair2015 keynote
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assurance
 
Spaghetti gate
Spaghetti gateSpaghetti gate
Spaghetti gate
 
Prototyping Accessibility - WordCamp Europe 2018
Prototyping Accessibility - WordCamp Europe 2018Prototyping Accessibility - WordCamp Europe 2018
Prototyping Accessibility - WordCamp Europe 2018
 
The Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with androidThe Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with android
 
Computer programming
Computer programmingComputer programming
Computer programming
 
Notes on Debugging
Notes on DebuggingNotes on Debugging
Notes on Debugging
 
Practical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgPractical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbg
 
9: OllyDbg
9: OllyDbg9: OllyDbg
9: OllyDbg
 
Preparing for the WebGeek DevCup
Preparing for the WebGeek DevCupPreparing for the WebGeek DevCup
Preparing for the WebGeek DevCup
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Getting better through Katas
Getting better through KatasGetting better through Katas
Getting better through Katas
 

Mehr von Janie Clayton

Beyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design AestheticBeyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design AestheticJanie Clayton
 
3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf ChicagoJanie Clayton
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015Janie Clayton
 
3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf Atlanta3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf AtlantaJanie Clayton
 
GPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaGPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaJanie Clayton
 
3D Math Without Presenter Notes
3D Math Without Presenter Notes3D Math Without Presenter Notes
3D Math Without Presenter NotesJanie Clayton
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerJanie Clayton
 
GPU Programming 360iDev
GPU Programming 360iDevGPU Programming 360iDev
GPU Programming 360iDevJanie Clayton
 
Gpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalGpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalJanie Clayton
 

Mehr von Janie Clayton (11)

Robots in Swift
Robots in SwiftRobots in Swift
Robots in Swift
 
Beyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design AestheticBeyond White: Embracing the iOS Design Aesthetic
Beyond White: Embracing the iOS Design Aesthetic
 
Thinking In Swift
Thinking In SwiftThinking In Swift
Thinking In Swift
 
3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015
 
3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf Atlanta3D Math Primer: CocoaConf Atlanta
3D Math Primer: CocoaConf Atlanta
 
GPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaGPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf Atlanta
 
3D Math Without Presenter Notes
3D Math Without Presenter Notes3D Math Without Presenter Notes
3D Math Without Presenter Notes
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
GPU Programming 360iDev
GPU Programming 360iDevGPU Programming 360iDev
GPU Programming 360iDev
 
Gpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalGpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and Metal
 

Kürzlich hochgeladen

AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 

Kürzlich hochgeladen (20)

AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 

Bug Hunting Safari

  • 2. Why is Debugging Hard? • We all know we should debug, but many people don’t know how to do it well. • Our community does not have an overly broad knowledge base about doing in-depth debugging because it’s hard to make time to learn it better. • We like to think that we can write all of our code perfectly without any mistakes, but unfortunately that is not the case, no matter how hard we try.
  • 3. – Crow T. Robot from Mystery Science Theater 3000 for those under the age of thirty or over the age of fifty “Well, believe me, Mike, I calculated the odds of this succeeding versus the odds I was doing something incredibly stupid… and I went ahead anyway…”
  • 4. Why is Learning Efficient Debugging Important? • Depending on the source, it is reported that a professional programmer spends only 1/6 of their time coding. Most sources agree that half of your time as a programmer will be spent debugging yours and other people’s code. • Learning tools, tricks, and common problems will free up more of your time so you can code rather than debug!
  • 5. Why is Learning Efficient Debugging Important? • At some point in your career, you will be working on code that you did not write yourself. The previous person will do things differently than you would have and you need to be able to figure out why something you did not write works and breaks. • You will continue to grow and mature as a developer. Looking at code you did three months ago can be painful and you probably won’t remember what you did or why.
  • 7. Why Have a Debugging Environment?? • Everything you do in work and in life is better when you have a dedicated set-up for it. Look at your kitchen. You have a dedicated space to doing a specific task and everything is arranged to make that as easy as possible • You have, or should have, a dedicated coding space to help you focus and be productive. If you want to be a productive debugger, you need to care about setting up your space and your tools.
  • 8. Debugging Console • Create a dedicated debugging tab • Make sure your bottom view is exposed • Can set many things to optimize debugging in XcodePreferencesBehaviors
  • 9. NSLog(): First Line of Defense!
  • 10. NSLog() • NSLog() is a function that you can use to print a message to your console. • NSLog() is a development tool. Nothing printed using NSLog() is seen by the user • Usually used to print out variables to the console in order to check their value and to ensure they are set • First type of debugging most people learn how to do
  • 12. Thing I accidentally make when I click on an error message that makes my program stop running.
  • 13. Flavors of Breakpoints • Breakpoint Logging • Exception Breakpoints • Conditional Breakpoints • Symbolic Breakpoints • Watchpoints
  • 14. Advantages of Breakpoints • Easier to clear out of production code than NSLog() statements. You should not include NSLog() statements in an app that is submitted to the App Store • More flexible than adding code to your project for debugging • Less likely to generate errors because you are not adding additional code to your project
  • 16. Logging with Breakpoints • Think back to when you were creating all those NSLog() statements. They were kind of messy, weren’t they? • You can use breakpoints to do the same thing
  • 18. When Do You Use an Exception Breakpoint? • Have you ever built and run your application only to have it crash and direct you to the Main.m file? You know the problem isn’t there because you haven’t touched it. How do you find out where the problem actually is? • You use an Exception Breakpoint
  • 19. Exception Breakpoint • What happens with Xcode is that when it encounters a problem in your code, it will keep going until it crashes. That is why it usually stops in the incredibly unhelpful Main.m class rather than where the problem actually is. • By creating an exception breakpoint, you are telling Xcode you want it to stop where the problem is rather than to keep going and crash somewhere else.
  • 21. Conditional Breakpoint • You are telling Xcode to stop if a condition is not met. • The condition must equate down to a true or a false. • You can use this in a loop if you need to know what the result of a certain iteration is by setting “Ignore ’n’ times before stopping.”
  • 23. Who Watches the Watchpoints? • Watchpoints are a tool you can use to keep an eye on any object that is going to undergo a change. • For example, if you have a label that is updated by input from the user, you can set a watchpoint on it.
  • 25. Symbolic Breakpoints • Used any time a specific method type is called. • For example, if you want to know every time the view loads you can create a symbolic breakpoint to do something when viewDidLoad is called.
  • 26. LLDB: Or How I Stopped Worrying and Learned to Love the Command Line
  • 27. What is LLDB? • All of the tools we have been working with so far are written in LLDB. • LLDB uses a command line interface. • Anything you did in Xcode, like setting a breakpoint, can be done on the command line in the debugging console.
  • 28. Why Would I Want to Know LLDB? • LLDB has more functionality than what has been built into the user interface in Xcode. • Writing code in the command line is faster and more efficient than having to use the mouse to move around selecting user interface elements. • You can do debugging in the terminal and bypass Xcode completely. If you want to use something like AppCode, this is a way to use LLDB.
  • 29. Why Would I Want to Know LLDB? • You can customize LLDB commands to suit your projects more closely • You can extend LLDB’s functionality with the use of Python Scripts
  • 30. Creative Way to Torture Your Coworkers
  • 31. Sound Breakpoints!! • You can program a breakpoint to generate a sound when something happens. • When you go on vacation, program all of your breakpoints to make annoying sounds when the program is running. Your less knowledgeable coworkers will go crazy figuring out where the sound is coming from!! BWHAHAHA!!!
  • 33. 99 little bugs in the code! 99 little bugs! You take one down, You patch it around! 117 little bugs in the code!
  • 34. Bugs are bad. You do not want bugs. You do not want to ship an app that has bugs. Bugs are the number one reason that apps are rejected from the App Store. ! Bugs happen. You don’t want to ignore little bugs…
  • 36. `