software

Interpreters vs Compilers

Introduction

In the early days of becoming a software developer, there is a steep learning curve including data structures, algorithms, language syntax, best practices etc. An important part that is sometimes overlooked is the actual understanding of the workings of these languages.

The workings of the interaction between software and hardware are not common knowledge; most people just accept the magic of computers and move on. But when you make your career in technology it’s always helpful to have a deeper understanding.

Background

The central processing unit (CPU) in a computer is responsible for the logic, taking in machine code and delivering a response. Machine code is usually composed of binary numbers (0’s and 1’s) and each 0 denotes an electrical switch being off and each 1 denotes the switch being on. In the ’50s, computers moved from vacuum tube switches to transistors which vastly improved reliability, temperature control and size. Transistors in the CPU switch electrical signals based on the binary input and use logic gates to process the information. Early transistorized computers utilised hundreds of transistors whereas nowadays there are billions packed into our microprocessors. Many languages can be implemented using either a compiler or an interpreter e.g. Java; for the purpose of this article, I will refer to languages with the implementation they are most associated with.

Compiled Languages

The machine code input that a CPU takes is not easily understood by humans. Compiled languages such as C++ and Java are written by people in a syntax we can much more easily read and understand.  Before running, a compiler converts this language to machine code and creates an executable file. Because this file is directly readable by the computer, the runtime will be much faster than for an interpreted language (we’ll get to why in a second). So, for large computations with lots of iterations, a compiled language will be far superior. The main drawback with compiled languages is the fact that compiling is an extra step in testing. For building applications, you want to be able to test and improve your code constantly and having to compile each time will accumulate a lot of wasted time. Personally, as a web developer, interpreted languages are the optimal choice.

Interpreted Languages

An interpreter is a program that takes code, written by the user, as input and directly executes it. This negates the need for a compiler as the code is executed at face value, but in running a programme to run the code; the runtime is much slower. Of course, for the computer to process the code, it must receive machine code; the interpreter will likely be written in machine code.

Summary

For large computations and programs where the runtime is crucial, compiled languages will be much more powerful. For smaller programs, an interpreted language may be preferred due to the easy implementation and quick testing. Interpreted languages also have some advanced predictive features, which makes them easier to use straight out of the box. When choosing a programming language for your project, it is best to consider its implementation and the attributes it entails.

Elliot works as a full-stack software developer at WayMaker Digital, helping clients to solve business and technology challenges.

WayMaker Digital provides technology consulting, product design and information products, that enable our clients to consistently thrive and innovate to meet user needs. The quality of our experiences and ideas set us apart when it comes to service delivery, customer experience design and product development. 

Our team of consultants have built digital experiences for leading brands with complex business scenarios ranging from startup companies to public services and from telecoms to e-commerce; no project deliverable is too complex.

Our approach: we adopt human-centred & design thinking models to solve complex business challenges, which ensure our clients are on top of their business.

Do you have a question or an enquiry; you want to discuss a project or need a free consultation? Give us a shout here.

Share with Friends

Leave a Comment

Your email address will not be published.

Scroll to Top