The heart of tech is coming to the heart of the Mediterranean. Join TNW in València this March 🇪🇸

This article was published on July 8, 2020

Building a programming language? It’s pretty much the same as playing with LEGO

Sometimes you just have to create your own solutions.

Building a programming language? It’s pretty much the same as playing with LEGO

This article was originally published on .cult by Niklas Priess. .cult is a media platform for untold developer stories, where developers can read content around the softer side of development and watch documentaries about the tech they love. You can read this original piece here.

Have you ever played with LEGO? If you want to build a house, for example, you have to start with a sturdy foundation. Once you have the foundation, it’s easy to add and change each element, like removing a wall and adding a door instead, or attaching an entirely new level to the top. I think you can see where I’m going with this.

My work is in payroll management and the legal system surrounding it is complex – there are a lot of differences between each country, so one standardized product won’t do. It became clear to us at PayFit that a scalable solution was needed to handle this complex system. Not only that, it would need to have enough speed to build our product across different countries. It didn’t make sense to build a new product for each market from scratch, it would take too much time and besides, the original product was already working. We needed a solution that would allow us to build on the product we already had, just like LEGO.

[Read: How the Dutch government uses data to predict the weather and prepare for natural disasters]

Building on the existing platform we could have hard-coded the calculation logic for each country in Python and JavaScript. However, thinking long term there were a couple of questions that were raised with this approach. How do we take into account how all of the laws changed each month in each country? Does the code remain simple and readable if you’re managing 2 countries as well as 50 countries? Calculating the net salary in Germany for example requires you to take into account more than 5000 different parameters which again can be dependent on a multiple set of conditions. So we saw that we will eventually run into problems with this approach and won’t be able to maintain flexibility in order to adjust the product quickly in the long term.

Finally, we decided on a solution that would take a while to set up in the beginning, but ultimately we’ve found it to be worth the investment. That solution was to create our own programming language: JetLang.

How does it work?

When car manufacturers build their vehicles, they don’t start from scratch each time. Trends are changing and new demands are set by consumers, so it’s important to react to these changes as quickly as possible. For example, a new battery has been developed, or with environmental awareness on the rise, consumers prefer hybrid and electric fueled vehicles over gas-powered ones. The manufacturers should be able to say, ‘no problem,’ to all these requests.

There’s a basic design that all cars rely upon – it’s just the details that change depending on what is needed and when. This is a modular approach, and ultimately it saves time in construction and remains flexible.

This is the same approach we’ve taken with JetLang.

Developers are able to implement the respective payroll logic for their country by creating variables and performing calculations based on complex conditional logic. The backend understands this language and translates it into the browser. Furthermore, they have access to a set of components that allows them to build the front-end and improve the overall UX for the users. What they are doing is not just development but product building and it is the core of our company.

How is this like LEGO, exactly?

JetLang represents the different types of LEGO-bricks that are provided by our tech team. Making use of those bricks, our product builders are able to build a solution that is tailored to address the specific legal and customer requirements for each country in a very short amount of time.

A perfect example of this is actually the current Corona-crisis. Due to the economic impact, most of the governments introduced specific laws for partial unemployment in order to save jobs and ease the financial stress of affected companies. However, the concrete form of this partial unemployment and the respective calculations are completely different for each country. This starts with the data that you need to request from the customer and ends with the actual calculation logic as well as the mandatory declarations that need to be sent to the governmental entities. Thanks to JetLang we were able to react to this situation quickly. Each country was able to implement the respective feature in no time by creating a few new variables and the respective condition logic.

On top of that, we used the components of JetLang like printers, input-fields, date-pickers, message-boxes and so on to quickly build the front-end page required for gathering the necessary information from the customer and showing them the respective calculation results. This was only possible because of our modular approach. Due to this, we don’t need to create new front-end pages from scratch, we don’t need to care about how to save the respective data in the database and we don’t need to care about calculation inside the browser. We have our powerful engine that takes care of all of that. In JetLang we only need to adjust the product by rearranging a couple of Lego-bricks.

It’s really that simple?

Although JetLang offers many advantages, it’s only one side of the equation.

Sometimes you will run into a particular problem that can’t be solved by our modular approach because the functionality for that simply does not exist in JetLang yet.

The problem could be something simple like erasing blank spaces from a string. Normally, this task would not state any problem as almost all programming languages will have a finished solution for each particular issue. But in our case, this actually requires our global development team to create another ‘brick’ to address the issue or gap in the language.

As resources are limited, we constantly need to assess priorities by seeing whether or not providing a specific functionality is actually beneficial for all countries and product builders. Sometimes this will result in the fact that we won’t be able to solve a certain problem because it is too specific, and we need to question if we can invest resources in providing the needed functionality.

This programming language seems company-specific…

Having to learn a new programming language that is only used within the company might seem strange. In reality, though, the position of the product builder gives the possibility to have a real impact on the product and to develop a unique and very broad skill set.

In most companies that build digital products, you usually have clear job profiles: a user researcher for the discovery phase of a new product or feature; a product manager for organizing the execution and communication for the development of this functionality and a developer who is simply coding the requested solution.

Here those tasks are incorporated in one person: the product builder. This allows the developer to have a unique and full-scale ownership over the product by identifying and planning product improvements and also delivering them. It’s incredibly rewarding work, and well, you are helping to improve the programming language at the same time!

Thinking in the long-term

I’ve been considering modularity and scalability for a long time, and I believe it’s the key to the success of a company. An ideal company should be similar to LEGO-bricks: starting with a sturdy foundation and a few stable layers, but beyond that, everything should be modular. Changing the structure of a house takes a couple of seconds as you`ll only need to rearrange some of the bricks to do so. Having this kind of flexibility is something crucial for almost every company in order to quickly address customer needs and adjust to changes in their environment.

Putting in the time early on to ensure speed and flexibility in the future is so important for the longevity and growth of a business. Focus on the long term and build your business – like LEGO.

Also tagged with