Posted on

Helping The Interpreter

I kept it simple for non-techs, please keep reading, you might learn something.

Safety in Numbers by Tobias Mathes, All rights reserved.

Introduction

In software development, we are using programming languages, which have similiar attributes like their spoken counterparts. Depending on their history some of them are in the same language tree and therefore have a similiar syntax then their siblings. By example, if your native language is German, then you have the possibility of learning Dutch, English or even Swedish, because all that languages are part of the same language tree. The same goes for programming languages, if you learn one specific programming language, then you potentially have access to whole lot of others. Unlike spoken languages however, programming languages always have to be translated into a language understood by the computer which is executing the program.

To keep things simple, languages used for web development are mostly 'interpreted' languages. Which means that everytime they are executed, they will be interpreted into a language the computer understands. The upside is, that you can change the software at any time and the changes are applied directly; unlike 'pre-interpreted' programs which have to be 'replaced' for every change to take effect. The downside is, especially if no changes were made, the 'interpreter' has to translate the software over and over again. Which is highly ineffective and therefore much slower.

There are some approaches to deal with this problematic, which leads us to the next section.

Translation Concepts

There are several concepts to help the interpreter with it's work. In non-technical terms, we let the interpreter write the translation on a piece of paper, which will be kept for a pre-defined timeframe or until the source material has been changed. After either of this pre-defined factors has been satisfied, the interpreter has to formulate a new translation and write it down again.

The main difference is, that we let the interpreter keep it's translation until certain criteria are satisfied, before it had to do the translation everytime a file would be executed.

For the sake of this article, PHP is an interpreter language.

In December 2011 Facebook published HHVM, a software they had been heavily relying on. Which to some degree revolutionised the PHP development community, because it enabled companies to 'pre-interpret' their software and gain severe performance improvements. For non-techs, by example to enable more people to visit their website without buying new servers.

At that time I was working for Global Leads Group as Team Leader PHP Development and my superiors asked me to assess the new technology for production use. Of course shortly after publication (tech: release), the software was not easy to handle and still needed some adjustments to be applicable outside the realm of Facebook.

There are situations where solutions like HHVM are necessary, because there is a limitation to how much a technical infrastructure can grow to keep up with the visitor stream. Unfortunately often enough the quality of the source code, the underlying of the software, is the main problem of a limited performance. You can enhance the speed of your software by using HHVM, but the improvements could be much better, if you address the underlying problem at first.

I can appreciate solutions like HHVM, I really can. However several years back, I was at a workshop about JAVA Enterprise, which is an official framework (non-tech: toolkit), which hence the name is mainly used in Enterprise environments, mainly in industries where reliability is more important then cool new technologies, like at automobile manufacturers or in the finance sector.

That workshop changed my approach on things like HHVM, in other words, I wanted that PHP as a language and it's interpreter overall gets better and in return, not to rely on a special solution like HHVM for a common problem, namely performance.

The Future

PHP 7.0 was finally released on December, 3rd 2015 and everyone who updates to the new version will benefit from it's performance improvements without the need of using a Third-Party-Solution like HHVM. Not only the performance of the interpreter got better, also the language got cleansed of historic remnants. This release is so exciting, because it leads PHP as a language into a new age.

Writing good software is like writing a good novel, you need simplicity to make it spectacular.