Skip to main content

There *Will* Be Bugs

Anna Ravenscroft (Self), Alex Martelli (Google)
Portland 251
Average rating: ***..
(3.27, 15 ratings)

If you’re pushing the envelope of programming (or of your own skills)… and even when you’re not… there will be bugs in your code. Both speakers have lots of experience perpetrating, finding, and fixing bugs. Most schools don’t cover bug-hunting in programming and computer science classes. We will cover the attitudes and skills that are most helpful to minimize your bugs, track them, fix them, ensure they never recur, and deploy fixes to your users.

In this talk, we will describe how to start tracking down those pesky bugs, where they like to hide, how your brain tricks you, making it harder to find the bugs, and the processes that will help avoid them (or catch them early). Testing, pair programming, code reviews, open source (“given enough eyes all bugs are shallow”), when to use a bug-tracker, are just some of what will be covered.

Of all the advice we impart in the talk, the one most important bit: once you’ve confirmed the existence of a bug, never start “fixing” it until and unless you have reproduced that bug in a unit test. Often this task surprises you by showing the bug is elsewhere than you originally thought – and in any case, writing the test, ensuring it breaks, fixing the code, and leaving the test (small, simple, fast) in your unit test suite forever, is the only way you can ensure that bug doesn’t slip in again without you noticing… (Some push this even further and apply “test-driven” or “behavior-driven” programming – far from bad ideas, if you find you can be productive using them!)

Most bugs tend to be concentrated in small parts of the code — the ones using too-advanced concepts, perhaps, or the ones where your original understanding of the problem (and thus the related architecture) was imperfect. You may discover where you have been too clever for your own good, and then you need to simplify those parts of the code. As Kernighan put it, “debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?"

Photo of Anna Ravenscroft

Anna Ravenscroft


Anna Martelli Ravenscroft has a background in training and mentoring. Her focus is on practical, real-world problem solving and the benefits of diversity and accessibility. Anna graduated in 2010 from Stanford University with a degree in Cognitive Science. She is a member of the Python Software Foundation, a program committee member for several open source conferences, winner of the 2013 Frank Willison Award, and co-edited the Python Cookbook 2nd edition. She has spoken at PyCon, EuroPython, OSCON, and several regional Python conferences.

Photo of Alex Martelli

Alex Martelli


Alex Martelli wrote “Python in a Nutshell” and co-edited
“Python Cookbook”. He’s a PSF member, and won the 2002 Activators’ Choice Award and the 2006 Frank Willison Award for contributions to the Python community. He works as Senior Staff Engineer for Google. You can read some PDFs and
watch some videos of his past presentations.