Part 1: Fundamental Concepts of Computing

3. What Is a Program & How Software Runs

What Is a Program & How Software Runs

A program is a set of instructions that tells a computer how to accomplish a task. You write those instructions in a programming language — a carefully defined vocabulary and grammar that is precise enough for a machine to follow, yet readable enough for humans to work with.

Source Code vs Machine Code

The text you type is called source code. It might read print("Hello"). But the CPU only understands machine code — raw binary numbers that correspond to its built-in operations. Something must bridge the gap between the human-friendly source code and the machine-friendly binary. That something is a translator, and there are two main kinds.

Compilers vs Interpreters

A compiler reads your entire source file and translates it, all at once, into a standalone machine-code file that you can then run. A interpreter instead reads and executes your source code line by line, every time the program runs, translating on the fly.

Analogy: a compiler is like translating a whole book into another language and handing over the finished translated book. An interpreter is like a live human interpreter at a meeting, translating each sentence as it is spoken.

AspectCompilerInterpreter
When translation happensOnce, ahead of timeEvery run, line by line
OutputA separate machine-code fileNo separate file; runs directly
Speed when runningUsually fasterUsually slower
Finding errorsMany caught before runningOften found only when that line runs
Example languagesC, C++, Rust, GoPython, JavaScript, Ruby

Some languages, like Java and modern Python, blend both approaches: source is first compiled to a portable intermediate form, which an interpreter-like "virtual machine" then runs.

Source codeprint("Hi") Compiler /Interpreter Machine code10110001... CPU

High-Level vs Low-Level Languages

  • Low-level languages sit close to the hardware. Machine code (pure binary) and assembly (short mnemonics like MOV and ADD) give fine control but are tedious and hardware-specific.
  • High-level languages like Python, JavaScript, and Java read much more like English and maths. They hide hardware details so you can focus on solving problems. One line of Python may expand into dozens of machine instructions.

As a beginner you will work in a high-level language — this course uses Python later — precisely because it lets you express ideas quickly without worrying about voltages and memory addresses.

How a Program Runs, Start to Finish

Putting the pieces together: you write source code in a high-level language; a compiler or interpreter translates it toward machine code; the operating system loads that code into RAM; the CPU runs the fetch–decode–execute cycle; and results appear through output devices. Every app you have ever used followed exactly this path.