Lesson Notes — What Is Programming? High-Level vs Low-Level Languages
Course 3: Introduction to Programming / Unit 1: What Is Programming & Program Development Life Cycle (PDLC) / Lesson 1: What Is Programming? High-Level vs Low-Level Languages
Lesson overview
Programming is writing instructions, called source code, that tell a computer what to do. The computer carries out those instructions during execution, which is when the program runs. The rules for how the instructions must be written are called syntax.
What the computer really understands
A computer’s processor understands only one language, machine code, which is long strings of 1s and 0s. Nobody wants to write that by hand, so people invented languages that are easier to read and added translators that convert them for the computer.
Low-level and high-level languages
- Machine code is the processor’s own language. It is the lowest level.
- Assembly is a low-level language that uses short words and symbols in place of 1s and 0s. It is still tied closely to one type of processor, and each line does a tiny job.
- High-level languages, such as Python, Java, and JavaScript, look more like English and hide many hardware details. One line can do the work of many machine instructions.
Hiding complexity so you can focus on the problem is called abstraction. Here is a one-line Python program:
print(2 + 3)
It displays 5. In a low-level language, the same job takes several separate instructions to move the numbers, add them, and send the result to the screen.
Compilers and interpreters
A computer cannot run high-level code directly, so a translator is needed.
- A compiler translates the whole program into machine code before it runs. Languages such as C and C++ are usually compiled.
- An interpreter reads your code and carries it out step by step while the program runs. Python is usually run with an interpreter, which is one reason it is good for beginners: you can run a small piece of code and see the result right away.
Comparing the two levels
| Feature | Low-level | High-level |
|---|---|---|
| Easy to read and write | No | Yes |
| Close to the hardware | Yes | No |
| Works on many kinds of computers | Usually no | Usually yes |
| Best for | Hardware control and jobs where speed matters most | Most apps, websites, and games |
Check your understanding
- In your own words, what does a compiler do?
- Why do most beginners start with a high-level language?
- In
print(2 + 3), what is the source code, and what happens during execution?
Use the Key Terms page for this lesson to build your glossary, and write each definition in your own words.