You press Run and it breaks
You write 10 lines of code. You press Run. A red error appears and you do not know why.
A builder has a hammer, a tape measure and a plan. A developer has tools too. Some tools help you write code. Some help you find mistakes. Some turn your code into a program the computer can run.
Other programs, such as email and spreadsheets, help everybody at work.
Key words
| Word | What it means | Example |
|---|---|---|
| IDE | Integrated development environment. One program with an editor, a debugger and more tools for writing code. | The tool a student uses to write code |
| Source code | The code a person writes, in a language like Python. | print("hi") |
| Machine code | The 1s and 0s a processor can run. | The file a compiler makes |
| Compiler | Translates all the source code into machine code before the program runs. | A tool that makes a program file |
| Interpreter | Translates and runs the source code one line at a time. | The Python interpreter |
| Debug | To find and fix mistakes in a program. | Run one line, then stop |
| Breakpoint | A place where the debugger pauses the program, so you can look. | Pause at line 12 |
| Syntax | The spelling and grammar rules of a programming language. | A missing closing bracket ) |
| Variable | A name that holds a value. | total = 0 |
| Database | An organised store of data that you can search. | A list of customers |
The cells students fill in are left blank in this preview.
What is inside an IDE?
| Part | What it does | How it helps you |
|---|---|---|
| Code editing tools | Colour the code, suggest words, find and replace, check the syntax as you type | Fewer typing mistakes and faster work |
| Debugging tools | Pause the program, run one line at a time, show the value of each variable | You find where the mistake is |
| Screen design tools | Drag buttons, boxes and text onto a window and see a preview | You build a screen without writing every line |
The cells students fill in are left blank in this preview.
Quick check: the IDE
Have a go
Quick check: the IDE
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Try it: find the bug
# This program has a mistake. Run it and read the error message.
prices = [2.5, 3.0, 1.5]
total = 0
for price in prices:
total = total + price
print("The total is " + total)
# Fix it: change the last line to print("The total is", total)
Compiler or interpreter?
Your source code is words. A processor only runs machine code. Something must translate.
A compiler translates the whole program first. Then you run the result. An interpreter translates one line, runs it, then moves to the next line.
Compiler and interpreter compared
| Compiler | Interpreter | |
|---|---|---|
| Translates | All the code first | One line at a time |
| Speed of the finished program | Usually faster | Usually slower |
| Errors | Reported for the whole program before it runs | Found when that line is reached |
| Good for | Large programs that must run fast | Learning, testing and quick changes |
The cells students fill in are left blank in this preview.