Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PyCon Canada - Rub-a-Dub Rubber Duck: Don't Be Afraid To Debug!

PyCon Canada - Rub-a-Dub Rubber Duck: Don't Be Afraid To Debug!

Everyone of us knows this scenario, it's part of the daily life of a programmer: You build something and it doesn’t work. You run into a bug, you find a problem, you break your code - and then you have to figure out how to fix it again. This can take 5 minutes, several hours, sometimes even several days. Sometimes you get really frustrated and are about to give up but when you finally find the solution it's the greatest feeling in the world. Do you want to learn how to proceed when your code doesn’t work? Do you want to learn how you can become a better problem solver? Do you want to learn how a rubber duck can help you? Then this talk is for you :) In this talk I will present strategies on how to proceed when you run into a bug or other coding problems. I will also talk about what you can do in order to prevent frustration and how you can learn to be more confident when encountering bugs. My goal is to show that bugs are nothing to be scared of, that you can fix (almost) everything and shouldn’t be afraid of breaking things, and that debugging can be easier than you think it might be if you approach it the right way. Breaking things is the first step to learning how to fix them!

Anna Ossowski

October 31, 2016
Tweet

More Decks by Anna Ossowski

Other Decks in Programming

Transcript

  1. bug noun Definition of BUG 1a : an insect or

    other creeping or crawling invertebrate (as a spider or centipede)b : any of several insects (as the bedbug or cockroach) commonly considered obnoxiousc : any of an order (Hemiptera and especially its suborder Heteroptera) of insects that have sucking mouthparts, forewings thickened at the base, and incomplete metamorphosis and are often economic pests —called also true bug 3a : a germ or microorganism especially when causing diseaseb : an unspecified or nonspecific sickness usually presumed due to a bug 4: a sudden enthusiasm 5: enthusiast <a camera bug> 6: a prominent person 7: a crazy person 8: a concealed listening device 9[from its designation by an asterisk on race programs]: a weight allowance given apprentice jockeys
  2. bug Noun Definition of BUG 2: an unexpected defect, fault,

    flaw, or imperfection <the software was full of bugs>
  3. debug verb de·bug \(ˌ)dē-ˈbəg\ Simple Definition of DEBUG : to

    remove the mistakes from (something, such as a computer program)
  4. Syntax Errors • Leaving out a keyword • Putting a

    keyword in the wrong place • Leaving out a symbol, such as a colon, comma or brackets • Misspelling a keyword • Incorrect indentation • Empty block
  5. • Accessing a list element, dictionary value or object attribute

    which doesn’t exist • Trying to access a file which doesn’t exist
  6. Logical Errors • Using the wrong variable name • Indenting

    a block to the wrong level • Using integer division instead of floating-point division • Getting operator precedence wrong • Making a mistake in a boolean expression • Off-by-one, and other numerical errors
  7. I made some changes to my code but I can't

    access my website on the internet and I don't know why and it's really frustrating. Please help me Google!
  8. Code English Translate def printme( str ): print str return

    This prints a passed string into this function.
  9. • Is the indentation correct? • Did you forget any

    commas or brackets? • Are there any typos? • Did you leave out a whole line of code?