Get startedGet started for free

Connecting Programs to Computers

1. Connecting Programs to Computers

In our introduction, we learned how a computer executes instructions. In this lesson we will learn the fundamentals of programming that translate to instructions for a computer.

2. Bridging human to computer instructions

Previously, we learned that the core language for computers is binary. Now, we’ll explore how humans can instruct computers using programming languages. These languages allow us to write instructions in a structured way that get translated into binary before a computer can execute it. Think of programming languages as intermediaries. Just like we need translators to communicate in different human languages, computers need translators to convert our high-level instructions into the binary code they understand. There are two primary ways to perform this translation: compilation and interpretation, which we’ll explore next.

3. Compiled languages: the movie production

First, let us talk about compiled languages. In this method, the entire program is translated into binary code before execution. Think of it like making a movie. The script is written, rehearsed, filmed, and edited before it is shown to the audience. This process ensures that everything runs smoothly when it is time for playback.

4. Example compiled languages

Compiled languages translate code directly into machine code before execution, offering faster performance and better optimization. Errors are caught at compile-time, reducing runtime issues. However, the compile-debug cycle slows development, and binaries are platform-dependent unless recompiled. Debugging is harder, and users can’t easily verify or modify the code without the source. Examples of compiled languages include C, C++, and Java.

5. Interpreted languages: the live theater

Next, let us discuss interpreted languages. Unlike compiled languages, interpreted languages are translated into binary code line-by-line during execution. This process is like live theater. The script is performed live on stage, allowing actors to make immediate changes and be flexible with their performance.

6. Example interpreted languages

Interpreted languages run code line-by-line via an interpreter, enabling faster development and easy debugging. They’re cross-platform and support dynamic features, but they run slower since code isn’t precompiled. Errors occur at runtime, potentially disrupting execution. Distribution requires an interpreter, and source code visibility can pose security risks and limit proprietary protection. Examples of interpreted languages include Python, JavaScript, and Ruby.

7. Let's practice!

Now that we know what compiled vs interpreted languages are lets test what we learned.