Skip to content

Your Code Doesn't Work, Now What?

mimiyin edited this page Sep 19, 2013 · 2 revisions

Comment out each line of code one at a time until it starts working again

  • Isolate where the problem is

Comment your code. Describe what's happening line-by-line in English

  • Understanding what your code is doing line-by-line is 80% of the battle!

When it doubt, print it out!

  • Make sure your variables are doing what you want them to do. Using println() to see what's going on frame by frame.

Do the math for 3 frames

  • Draw out and calculate all of your variable values for 3 frames of draw()

Break it out

  • Once you've isolated the problem area, extract it from your big complicated sketch and try to get it working all by its onesies in a simple sketch.

Unload your burdens

  • Try explaining it to someone else. The icm-list is a great place for that.
  • Remember to start at the beginning: I'm trying to...But this happens....instead of that happening...