Compiler VS Interpreter

Johnnie Gonzalez
3 min readApr 20, 2021

--

Season 4 of Friends :)

As a junior developer it’s almost a matter of time until you start interviewing for that big dream company you’ve always wanted or even just a startup company to get your foot wet and in that door. You will study day in and day out as is the situation for me currently. I highly doubt that will ever stop though due to the way my curiosity levels are set up 🤓. The amount of information that you feel you need to study can be overwhelming, but you might actually build that confidence going into the first round of interviews after it all. That is until you are asked specific questions about programming that you might have heard the terminology for, but you can’t exactly remember what it is. Yeah well that has happened to me a few times. In particular “What is the difference between a compiler and an interpreter?”

If you’re wondering if I successfully answered that question correctly the answer is… ::drum roll:: …no 😥. So what brings me to write this blog is to help readers like you and I better understand what compilers and interpreters are and their differences. In hopes of helping you confidently answer that question in the future. Let’s start with what they are!

Season 5 of Friends :)

Compilers and interpreters are programs that help convert high-level programming languages from human-readable source code to machine code, which is understood by computers in binary format of 0’s and 1's. High level languages are ones that are understood by humans such as JavaScript, Python, Java, Ruby, C, C++ etc.

The differences between Compilers and Interpreters

1.) Compilers first reads all the source code at once. Then converts the source code into machine code creating runnable program files, such as “exe file”, that will be linked. All before running the actual program. Where as with interpreters they will convert the source code line by line to machine code while running the program.

2.) Compiled code runs faster compared to interpreted code. Simply because interpreters execute source code line by line during the programs run time causing the program to be slow altogether.

3.) For a compiler more memory is needed because the creation of other files in, which the program needs in order to run. Making interpreters highly efficient when it comes to memory since it runs without the need to create any other files.

4.) When an error occurs in interpreted code it will stop at the line of the error making it easier to fix the bug (problem). With a compiler considering it generates the whole program at once it only throws an error after completion. Making it harder to pinpoint the bug.

5.) There is a platform dependence that is needed for the compiled code to generate the binary code. With interpreted code it is platform independent because interpreters actually execute the source code themselves without the need of another file to run.

Now there are more differences so these are just a few that I found interesting and REALLY wish I knew but hey! Now I do! ::does dance:: Just remember it takes time and research to even understand topics like these so I hope it helped you and you are now one step (or a few) closer to landing that job! Now a FRIENDly reminder 👈👈 see what I did there! 😂………

Season 6 of Friends :)

Thank you for reading! Below are a list of my resources enjoy!

--

--

Johnnie Gonzalez

Software Engineering creative with background in architectural design. Love for sustainable design and tech!