3️⃣

Debugging

 
 
The process of debugging means figuring out what’s wrong with your code!
We’ve all done this on our own before, but learning how to do it well is one of the key aspects of being a programmer.
A great idea is to isolate the Sprite that isn’t working or figure out what is or isn’t happening, and then trace back to the code that controls that portion of the game!
 
Main steps of debugging:
  1. Ask the question- what do I want my program to do?
    1. Having a specific GOAL or INTENTION in your game will help you a lot!
  1. Ask another question after that- what is NOT doing what it needs to be doing in order for my game/program to work as it should?
    1. Isolate what isn’t working! Maybe a score counter is not going up, maybe a sprite isn’t moving correctly. Figure out WHAT the issue is first!
  1. Go to the code segment for whatever isn’t working!
    1. The reason we isolated the issue in the last step was so that we could do this one- go to the code for the thing that isn’t working!
      If it’s a sprite movement issue, go to that sprite and look for any blue movement blocks in the code to try to figure out which one isn’t doing what you would like it to.
  1. Fix what needs to be fixed!
    1. You can do this through a lot of methods: trial and error/guess and check is always a good one! Another great option is to look at past projects with similar code.
  1. Ask peers or your teacher for help
    1. It’s perfectly okay to turn to others! Once you’ve done everything you can, there is NOTHING wrong with asking others for help!
  1. Test your program!
    1. This step will likely be repeated a LOT throughout the developmental process- press that little green flag and figure out what you need to work on next!
 
 
 
⚖️
Copyright © 2021 Code 4 Tomorrow. All rights reserved. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.