Debut It! Tips and Techniques

14 views
Skip to first unread message

Laurie Bartels

unread,
Jun 15, 2013, 7:08:04 AM6/15/13
to creative-comp...@googlegroups.com
For these 5 projects my strategy was to always first look at each of the scripts and see what each script was causing to have happen. My next step was to consider how I might fix the bugs. And then I tried out my ideas. Rather than make all the changes at once, I tend to test out changes as I am making them, so I can see if the scripts are doing what I anticipate they will do.

Tips for programming and debugging:
  • make ample use of the WAIT block in between other blocks to isolate the impact of each block
  • drag individual blocks into the scripts pane and click on them as needed - for instance, the SHOW block, the GO TO X,Y block 
  • click in the boxes next to the last 3 Motion blocks - X POSITION, Y POSITION and DIRECTION - to see where a sprite is and which way it is facing; same idea with the last 3 Looks blocks, and some of the blocks in Sound and in Sensing
  • if you remain stumped, get up and do something else and return to your project later; often a little break will pave the way for an "ah ha" moment
In some cases, my solutions worked on the first round. In other cases, I did a little bit of trial and error till the fix was in.

In helping someone else to debug, I would guide them with questions and statements, samples of which follow. I would adjust my suggestions and questions to the age and experience (and frustration level!) of the person being assisted. 
  • What do you want to have happen?
  • Look closely at each sequence of blocks and tell me - in sentences - what you think they do.
  • How could you isolate the blocks to see what each one was causing to have happen?
  • What block might you insert to slow things down so that each block has sufficient time to do its own thing?
  • Have you thought about using some of the blocks that have rectangles next to them? If you click in a rectangle, the block's value will be displayed on the screen. How might you make use of that information to debug?
  • You can drag the SHOW and HIDE blocks, as well as some other blocks, onto the scripts pane and place them to the side for clicking on whenever you just want the sprite to do that one activity. This can be useful when testing out portions of your program.
  • You can click on a series of blocks in the scripts pane to have the sprite just respond to those blocks. The tip in the bullet point immediately above this one comes in handy as an accompaniment.

I LOVE debugging! Super sleuth on the case. :-) 

Laurie Bartels

unread,
Jun 15, 2013, 7:33:56 AM6/15/13
to creative-comp...@googlegroups.com
Ooops, should have included these in my initial post!

My debugging projects can be found here: http://scratch.mit.edu/studios/215060/

And my solutions, which are noted in each project, are also listed below.

Debug-It 2.1 – Gobo is silent. Perhaps a sore throat? SOLUTION: To give Gobo a voice, add the "meow" sound in the Scripts/Sound/Costume panel, then add the "play sound Meow" and "say Meow!" blocks to the Green Flag script.

Debug-It 2.2 – No matter what, the Scratch cat always counts to 10. SOLUTION: The Green Flag script asks what number to count to and stores that reply in "answer". The Define Counting block was scripted to repeat the counting process 10 times. The fix is to set the repeat to "answer" (instead of 10), which will let the Scratch cat count to whatever number was typed in when the Green Flag is clicked.


Debug-It 2.3 – Everyone is so excited that they are all shouting out at once! SOLUTION: The Scratch cat just needed to have the sequence of the Green Flag script changed so that each SAY was followed by the proper BROADCAST, and then a WAIT was inserted between all the blocks (except for the first two).


Debug-It 2.4 – Gobo isn't hearing the Scratch cat's directions to jump. SOLUTION: Gobo has the "When I receive JUMP" block all set to listen for the Scratch cat's broadcast, but the Scratch cat was missing the "broadcast JUMP" block. Easy solution: add the block to the bottom of the Scratch cat's Green Flag script.


Debug-It 2.5 – The dinosaur is a dance-a-holic, but dancing should only be happening in the Auditorium, and the dinosaur should only be visible when in the Auditorium. SOLUTION: When the Green Flag is clicked, HIDE the dinosaur. When the Stage backdrop switches to Auditorium, "broadcast showDinosaur", and change the dinosaur's event to "when I receive showDinosaur". In the "receive" set of blocks add a "switch backdrop to auditorium" followed by a "show". Press the space bar for some musical accompaniment, and press the "s" key to save the Dinoasur from sore feet.

Annette Haynes

unread,
Jun 15, 2013, 11:23:58 PM6/15/13
to creative-comp...@googlegroups.com
Great ideas!! Copying them into my notes to share with credit.

Susan Ettenheim

unread,
Jun 16, 2013, 5:33:03 PM6/16/13
to creative-comp...@googlegroups.com
Hahahaha Laurie - I love your comment about the strategy needing to relate to the frustration level of the debugger! That is so true from my experience. Also, I find that sometimes another student will have much better luck debugging with someone in trouble than I will have. Students will definitely have more patience with another student sometimes than with the teacher. I will try and the debugger will sigh - ugh it's the teacher asking a million painful questions again but with another student, they will pour over the possibilities and then a third will come over to help too!
Reply all
Reply to author
Forward
0 new messages