What exactly are the differences between compiling and interpreting a programming language? 🤔

Choose one(Not doughnut 😂) wisely after reading

In this article, we’ll be overviewing the differences between compiling and interpreting a programming language in modern-day computing. Programmers have the choice now between many different programming languages. The choice of a programming language depends on many different factors such as what platforms the programmer wants to develop for or kinds of applications the programmer wants to create whether that be a web-application or a mobile or desktop game or even an operating system. One other factor that will usually weigh in on a programmer's decision to prefer one language over another could be whether that particular language is usually compiled or interpreted.

Notice my careful use of the word usually in the last sentence this is because languages are independent of how they are actually implemented, it’s not that one language can’t be interpreted or can’t be compiled. But today most languages naturally fall into these categories given their feature set and the tools that have been made available for them.

Just wanted to get this out of the way since a lot of programmers seem to think otherwise.

Let’s start the show:😍

A simple scenario where I the programmer wants to send out my coded application to you the consumer.

The first way I could do this would be, compile the program on my computer using a compiler which would take my human-readable source code and convert it to its binary machine code equivalent. After this process is complete. I now have two separate files:

one original file containing my source code and another an executable file containing the binary code for the CPU on a certain computer to run.

Now, I can send you the consumer the binary executable file and tell you can run my application.

The second way of distributing and running my application would be through interpreting my program source with the use of what’s called an interpreter.

In this method, I would send you the actual source code I wrote instead of a compiled executable(.exe) file. With my source code in hand, you would then download an interpreter program for your machine and then you could take my source code and interpret it on the fly into a running program.

But what exactly do I mean on the fly.? 👀

In the compiling scenario,

The entire program source code is converted first before any computer can run it. This way my entire program is already translated into its binary form ready for the CPU to execute.

In the interpreting scenario,

I send you my original source code for which the interpreter goes through one line at a time converting each line to its binary equivalent and then executing that line immediately before moving on to the next line.

Pros and Cons 😔

So what are the advantages and disadvantages of these two approaches?

Well, let’s start with compilation

Compiling a program is always going to be faster than interpreting one. If speed is your main concern then you’ll probably want to precompile your language.

Also compiling a language first means that your original source code is kept private as no one will be able to read your optimized machine code.

Whereas, with interpreted languages, your source code is freely distributed to the public, so anyone can see exactly how your program works.

Some of the disadvantages of pre-compiled programs include having to recompile your program for specific platforms this means that you would have to make sure you created separate binaries for Windows computers, Mac computers and Linux computers and even then you would have to create CPU specific binaries from within those platform build.

This means compilation is not cross-platform and is pretty inflexible also during development.

Compilation requires an extra step compiling your program each the time you want to run your application for debugging purposes for bigger projects this extra step can add a considerable amount of time to a program's development.

For interpretation, we’ve already mentioned most of its disadvantages as it’s often slower given its line by line translation in real-time and it’s freely distributed source code. However, the interpretation also flips most of the disadvantages of compiled languages on their head interpretation is cross-platform so the programmer only needs to distribute one file instead of 20 and let the interpreter program on the consumer’s machine do the rest. Interpreting a language also makes things easier to debug since we don’t have to worry about the extra step of compiling every time we want to check our code.

Compiled versus interpreted normally languages such as C, C++, and Objective C, Go are compiled while languages such as PHP JavaScript Java C# and Python are interpreted.

Key Notes:🧐

  1. PHP and JavaScript their interpreters don’t have the extra functionalities of using bytecode and JIT compilation.
  2. Python is both compiled and interpreted 🤔




Python lover by passion, React Native Engineer by Profession. For sure, these are not the only ones I worked on 😉 .

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Daily progress — Attack Animation

GitHub Projects 🤗

So Easy MicroPython — Switch vs. Debounce

Vulkan on Android 6 — VR Stereo Rendering Part 3: Implementation

Don’t ever again write // TODOs

Things you should know about software architecture

Google Colab mount Google Drive and connect with Weights and Biases to track model training…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Python lover by passion, React Native Engineer by Profession. For sure, these are not the only ones I worked on 😉 .

More from Medium

All (Googly) Eyes on Me

Long drives, listening to music: Bizarre hobbies in CVs in a viral twitter thread

Good Night, Data Matters

G1 Continious Bézier Surfaces | Flag