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

DjangoCon Europe - Rub-a-Dub_Rubber_Duck__Don_t_Be_Afraid_to_Debug_.pdf

DjangoCon Europe - Rub-a-Dub_Rubber_Duck__Don_t_Be_Afraid_to_Debug_.pdf

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

March 30, 2016


  1. About me...

  2. Rub-a-Dub Rubber Duck: Don't Be Afraid to Debug! Anna Ossowski

    @OssAnna16 DjangoCon Europe 2016
  3. Photo CC BY-ND 2.0 Yoshihide Nomura

  4. Photo CC BY-SA 2.0 A Silly Person

  5. 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
  6. bug Noun Definition of BUG 2: an unexpected defect, fault,

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

    remove the mistakes from (something, such as a computer program)
  8. Photo CC BY-NC-ND 2.0 Ollie J

  9. Image CC BY 2.0 Jurgen Appelo

  10. 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
  11. None
  12. None
  13. None
  14. None
  15. None
  16. Runtime Errors/Exceptions

  17. Division by Zero Error

  18. None
  19. None
  20. None
  21. Using An Identifier Which Has Not Been Defined

  22. Performing An Operation On Incompatible Types

  23. • Accessing a list element, dictionary value or object attribute

    which doesn’t exist • Trying to access a file which doesn’t exist
  24. None
  25. None
  26. None
  27. None
  28. 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
  29. Python Textbook: https://python-textbok.readthedocs. org/en/latest/Errors_and_Exceptions.html Python docs: https://docs.python.org/2/tutorial/errors.html

  30. None
  31. 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!
  32. The 8000/ link doesn't work in Django.

  33. Django can't access development server in browser

  34. None
  35. None
  36. None
  37. None
  38. None
  39. Photo CC BY-NC-ND 2.0 misschristi1972

  40. Code English Translate def printme( str ): print str return

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

    commas or brackets? • Are there any typos? • Did you leave out a whole line of code?
  43. None
  44. None
  45. django-debug-toolbar: https://django-debug-toolbar. readthedocs.org pdb: https://docs.python.org/2/library/pdb.html Pyflakes: https://pypi.python.org/pypi/pyflakes Pylint: https://pypi.python.org/pypi/pylint PyChecker:

    https://pypi.python.org/pypi/PyChecker Pep8: https://pypi.python.org/pypi/pep8
  46. None
  47. None
  48. You are not the code you write!

  49. None
  50. None
  51. None
  52. CFP open until April 18th https://2016.djangocon.us/speaking/ Call for nominations of

    PSF directors starting in April/May
  53. None
  54. Thank you!