CRUSH THE BUG A FAMOUS BUG TERMS TO
CRUSH THE BUG
A FAMOUS BUG
TERMS TO KNOW • Bug-glitch or error in a computer program • Debug-to fix a glitch or error in a computer program • Compiler-A program that translates instructions or code into a language that can be read and understood by a computer. • Anomaly-Something unexpected that happens while a program is running.
FINDING A BUG • Computer programs don’t always do what you want them to do. When the outcome or event that’s supposed to happen doesn’t happen the way you think it should, you should start looking for a bug.
FINDING A BUG • What does the program do when you run it? • What should the program do that it’s not currently doing?
CODE TRACING CHART • Code trace-A method to analyze and record information about a program's execution. • Purpose of code tracing-to help detect bugs & to debug a computer program. • The first column on the chart shows a group of code that represents a part of the program’s procedure. • The second column describes what happened when that code was run. • The last column is where you determine whether the outcome of that code was what it was supposed to be. • Every code tracing chart has a creative title!
INFORMATIVE LEDS • Light-emitting diodes (LEDs) are energy-efficient and can be programmed to show a variety of symbols and images. • Airports and bus terminals often use LED signs to scroll and update information quickly. • When the images are lit up in a sequence, the LED image appears to move.
EMOJIS • A small image used to express an idea or emotion in digital communication. • Include facial expressions, hand gestures, common objects, weather, and animals. • So they can be used in a variety of apps and countries, each new set of emojis must be approved by the Unicode Consortium. • Each emoji has a Unicode • The Face with Tears of Joy has a Unicode of U+1 F 602
COMMENTS • Used in most programming languages • Comments make it easier to communicate about your program with others and isolate any bugs. • Comments can help you identify chunks of code, logical procedures, or program setup instructions.
ADDING/REMOVING COMMENTS Buggy Code Activity
DEBUGGING STEPS 1. Check your hardware. 2. Review your comments and algorithms. 3. Code trace. 4. Test outcomes. 5. Corner the bug (isolate the anomaly). 6. Crush the bug (rework the code). 7. Test outcomes again.
BUGGY CODE DETECTIVE ACTIVITY Now put your detective skills to work to debug a program that’s not operating correctly! As a member of one of the following five teams, you’ll debug a program and share your solution with the class.
BUGGY CODE TEAMS • Termites • Dragonflies • Fire Ants • Moths • Yellow Jackets
BUGGY CODE DETECTIVE ACTIVITY 1. Import your buggy program into the Microsoft Make. Code programming environment. Your program will have the same file name as your team name. 2. Each team member must follow the debugging steps you learned earlier. Remember to create a code tracing chart and use any comments in the program to help you isolate the bug and crush it. 3. When you’ve finished debugging your team’s program, compare your work with that of the rest of your team members. One person from each team will share their team’s debugging solution.
BUGGY CODE DETECTIVE ACTIVITY POST ACTIVITY QUESTIONS 1. How did you find the bug(s)? 2. What clues helped you isolate the bug(s)? 3. Explain how you fixed the Buggy Code program.
THE BLINKING MESSAGE PROJECT
THE BLINKING MESSAGE PROJECT For the Blinking Message project, you’ll design and program an animated LED message using letters, symbols, and images, like an emoji. Your LED message to your friend can include scrolling words, but just like a handwritten note or a text message, you’ll also want to include some images. You’ll share your finished blinking message on the micro: bit microcontroller, your plans for the message, and your program. You will document ALL of your Work in your Intro to Coding notebook.
BLINKING MESSAGE REQUIREMENTS • Part of the message scrolls • Uses letters, numbers, or symbols • Displays at least one image • Displays at least one animation (a sequence of images to show movement)
- Slides: 18