Code Tracing / Bugs
1. 4 - January 12, 2022
TEAMSCLASS NOTEBOOK ANSWER ESSENTIAL QUESTION
What are TWO WAYS we can protect the Micro:Bit and ourselves from being shocked? What do you think debugging means in regards to computer science?
CODE TRACING - TABLE CHAT
- WHAT DO YOU THINK IT IS?
- WHY DO YOU THINK WE WOULD NEED TO USE IT?
- WHAT WOULD BE THE BENEFITS OF USING IT?
THE WHY
CODE TRACING
Code tracing is a method to analyze and record information about a program's execution. Computer programs don’t always do what you want them to do.
BUGS In Computer Science
A bug is a flaw in a computer program that causes the program to produce an incorrect result or behavior.
BUGS In Computer Science
Code Tracing allows computer scientists to break down programs into logical parts and determine whether each part of the program does what it should. (Helps them find the bugs/ anomalies) An anomaly is something unexpected that happens while a program is running.
Not All Issues are Code Related
Before you begin analyzing your code to debug your program, you should always check any hardware FIRST. Check all the electrical connections. Ask yourself:
- Are the wires connected correctly?
- Are the connections good and tight?
If you still can’t get your program to run properly after checking your hardware, then begin debugging your program.
A famous bug
On September 9, 1947, United States Navy Rear Admiral Dr. Grace Hopper was working on a Mark II computer in a research lab when something went wrong. The computer’s operation stopped working correctly. When Hopper and her crew investigated the problem, they found a moth stuck in a relay inside the computer. Hopper’s team taped the dead moth to their notes and wrote below it, “First actual case of bug being found.” You can find the original log entry, moth remains included, at the Smithsonian Institution’s National Museum of American History in Washington, D.C. (Catalog Number: 1994.0191.1).
A famous bug
The term ‘debugging’ rises in popularity
The word bug had been used to describe engineering glitches or problems long before 1947. In the 1870s, Thomas Edison shared how bugs were found in electrical circuits. Edison first confronted what he later called a bug when he began developing a quadruplex telegraph system to transmit and receive up to four separate telegrams on a single wire simultaneously.
The term ‘debugging’ rises in popularity
Edison worked around this by building what he later called a “bug trap” to isolate the unwanted break so that it wouldn’t interfere with the meaning of the Morse-coded signal.
The term ‘debugging’ rises in popularity
While Hopper never used the word debug in her team’s notes, they found the discovery of an actual bug as the problem quite amusing. This story helped popularize the terms bug and debugging in computer science.
practice
The following program should blink an LED in the center of the LED grid on a micro:bit. The LED should light up for 0.5 seconds (or 500 milliseconds) and turn off for 0.5 seconds (or 500 milliseconds). The LED should continue doing this forever when someone presses the A button. Take a look at this program and create it in the Microsoft MakeCode programming environment.
- What does the program do when you run it?
- What should the program do that it’s not currently doing?
practice
- After you’ve isolated the anomaly or bug, try changing your copy of the program in the Microsoft MakeCode programming environment to fix it.
- When you think you’ve crushed the bug, test the program again in the emulator or on a micro:bit.
Code Tracing and Debugging
Caroline Bucky
Created on January 12, 2022
Start designing with a free template
Discover more than 1500 professional designs like these:
View
Psychedelic Presentation
View
Chalkboard Presentation
View
Witchcraft Presentation
View
Sketchbook Presentation
View
Genial Storytale Presentation
View
Vaporwave presentation
View
Animated Sketch Presentation
Explore all templates
Transcript
Code Tracing / Bugs
1. 4 - January 12, 2022
TEAMSCLASS NOTEBOOK ANSWER ESSENTIAL QUESTION
What are TWO WAYS we can protect the Micro:Bit and ourselves from being shocked? What do you think debugging means in regards to computer science?
CODE TRACING - TABLE CHAT
THE WHY
CODE TRACING
Code tracing is a method to analyze and record information about a program's execution. Computer programs don’t always do what you want them to do.
BUGS In Computer Science
A bug is a flaw in a computer program that causes the program to produce an incorrect result or behavior.
BUGS In Computer Science
Code Tracing allows computer scientists to break down programs into logical parts and determine whether each part of the program does what it should. (Helps them find the bugs/ anomalies) An anomaly is something unexpected that happens while a program is running.
Not All Issues are Code Related
Before you begin analyzing your code to debug your program, you should always check any hardware FIRST. Check all the electrical connections. Ask yourself:
- Are the wires connected correctly?
- Are the connections good and tight?
If you still can’t get your program to run properly after checking your hardware, then begin debugging your program.A famous bug
On September 9, 1947, United States Navy Rear Admiral Dr. Grace Hopper was working on a Mark II computer in a research lab when something went wrong. The computer’s operation stopped working correctly. When Hopper and her crew investigated the problem, they found a moth stuck in a relay inside the computer. Hopper’s team taped the dead moth to their notes and wrote below it, “First actual case of bug being found.” You can find the original log entry, moth remains included, at the Smithsonian Institution’s National Museum of American History in Washington, D.C. (Catalog Number: 1994.0191.1).
A famous bug
The term ‘debugging’ rises in popularity
The word bug had been used to describe engineering glitches or problems long before 1947. In the 1870s, Thomas Edison shared how bugs were found in electrical circuits. Edison first confronted what he later called a bug when he began developing a quadruplex telegraph system to transmit and receive up to four separate telegrams on a single wire simultaneously.
The term ‘debugging’ rises in popularity
Edison worked around this by building what he later called a “bug trap” to isolate the unwanted break so that it wouldn’t interfere with the meaning of the Morse-coded signal.
The term ‘debugging’ rises in popularity
While Hopper never used the word debug in her team’s notes, they found the discovery of an actual bug as the problem quite amusing. This story helped popularize the terms bug and debugging in computer science.
practice
The following program should blink an LED in the center of the LED grid on a micro:bit. The LED should light up for 0.5 seconds (or 500 milliseconds) and turn off for 0.5 seconds (or 500 milliseconds). The LED should continue doing this forever when someone presses the A button. Take a look at this program and create it in the Microsoft MakeCode programming environment.
practice