The Path To Better Debugging on iOS

Brian Kernighan famously quipped, “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”

That debugging is hard is a universal truth, however the unmanaged code we write as Cocoa developers does make our life somewhat more difficult. We can’t always stand on the shoulders of @mikeash, @gparker & @bbum when we get a crash in objc_msgSend()!

Kernighan’s second point is even more salient — while it may be tempting to write tricky code, it can become a debugging nightmare. If you anticipate the need to debug code while you’re writing it, you’ll be better off when you’re tracking down yet another heisenbug.

In this talk I’ll discuss the tools you can use to make debugging easier, and some techniques for ensuring you’ve not coded a rope long enough to hang yourself. You’ll walk away with some extra arrows to your debugging quiver, and a better idea of how to write more debuggable code.