Compiled and Interpreted Language

By Rasyue | On March 21, 2022

Compiled and Interpreted Language can a be very simple thing to understand yet confusing to beginners.

You are probably a software engineer or developer if you are reading this article. Additionally you might also be trying to figure out the difference between compiled and interpreted language.

The topic is not that crazy hard but it’s still worth it to know and understand these two things. You might get a question on this topic on your next interview.

Introduction

Have you ever wonder how your programming code or script runs and then it achieve whatever purpose that you want it to be?

For example if you are doing in Python, how does the computer knows how to read the Python code that you wrote? Or maybe if you are coding in Golang, how does the computer understand the Golang script that you write and then translate it into purpose?

We are going to talk about what does it means by compiled language and interpreted language.

Compiled Programming Language Explained

Compiled programming language is language that needs to go through a compiler first to be compiled before your machine can read the code and runs it. The resulting compiled code is usually in binary code which the machine can read.

A compiler is just a software program that will takes a human-readable code and then turns it into binary code.

Golang, Rust, C and C++ are a popular examples of compiled programming language. Different programming language will require different type of compiler.

More about Compiled Language…

Any compiled programming language is usually extremely fast because of the fact the you have to build/compile it first.

However, keep in mind that the time that it takes for the compiler to compile your source code can vary depending on the source code language and other factors.

It is also worth to note that usually, when you compiled or build your code, your result binary code is usually platform dependent.

This means that if you compiled it in a Windows machine, it usually won’t work in per say Linux or MACOSX unless you build it to work on multiple platforms.

compiled language
Photo by Mati Mango from Pexels

Interpreted Programming Language

Interpreted programming language is programming language that is interpreted by an interpreter before the machine can runs it.

An interpreted language relies on an interpreter which will read the human-readable code and executes the code line by line.

Additionally, an interpreter is a software program that read the code, and unlike compiler, interpreter does not product any binary code.

Python, Javascript, Ruby and PHP are good examples of interpreted languages.

More About Interpreted Language…

Unlike compiled language, interpreted language is usually slower than compiled language. When you run your interpreted language script for example Python, an interpreter will have to read, analyze and execute every line, one by one.

However, one of the good things with interpreted languages, they are not platform dependent. You can run your script in any platform you want provided you have the correct interpreter for that platform.

More on the Topic…

Every programming language we have today, should fall under one of these two, compile or interpreted.

However, there is also language that is consider as both compiled and interpreted. For example, Java is considered to be both compiled and interpreted language. With Java, the code is first compiled before running in a JVM which is usually an interpreter.

C# can also be consider as both but many argues so but I will consider that C# is a compiled language.

Comparison Between The Two

I am not going to make cringey comparison to showcase which one is better because to me, any language is a great programming language if you use it correctly and to its strong point.

Do not try to use a programming language to achieve something that it’s not supposed to do.

Like for example, using Golang to create a frontend application. I know that it can be done but the effort to do so is a waste of time. Or maybe if you use JavaScript to do data analytics work. It just doesn’t clicks.

The End…

To summarise, compiled language needs to be compiled first into binary code before the machine can runs the code. On the other hand, interpreted language does not need to be compiled, instead an interpreter will read and analyse the code line by line and executes it.

See you people in the next post!