How to Debug

Lucky you – debugging is so much easier now. No putting millions of print statements in your code! But, there still are some steps to make it more efficient and to produce better quality code.

  1. Reproduce:  Can you reproduce the error when you want to?  If you can’t, that means you do not fully understand what the bug is.  Make sure you know when and how a bug is happening.  Really stuck?  You can ask AI for help but try to do this on your own first so you understand your code.
  2. Isolate:  what bit of code is actually broken?  Data?  Logic?  Calls? Interaction between functions?
  3. Ask a specific question:  Not just “why isn’t my code working?” but “why is does the score reset when I flip to a previous card?”  Give Claude as many details as you have.  It will get fixed quicker and better.
  4. Verify:  Make sure the fix actually got rid of the bug not fixed it in one instance.  Can you look at the code and see the change?  Claude will show you what is changing – make sure you understand that.
  5. Check for Damage:  did fixing this break something else?  Test other features around this bug.