Poor Erlang. It’s a bit like the red-headed stepchild of the programming language family – neglected, unwanted, and constantly having the existence of its soul brought into question.
The truth is that Erlang is a quiet achiever. It’s a quirky language that may not be popular, but it is a handy tool to have at the ready to bust out when a problem needs an unorthodox solution.
If you’re new to Erlang, here’s 5 things you need to know.
For most people, Erlang is something that doesn’t even make a blip on their radar. It’s probably one of the most widespread programming languages that you’ve never even heard of.
No programming language is overly useful on its own – no matter how good it is. Erlang is a little different though. You combine this programming language with a powerfully optimized runtime environment, and some middleware to handle scalability and reliability, and what you have on your hands is a programming language that can act as a virtual machine as capable as an operating system, with a set of middleware libraries that resolve many of the annoying problems encountered with scaling up whilst maintaining system reliability. You’ll see why Erlang should be on your radar when you take a look at who’s using it.
1 – WHO’S USING ERLANG:
The big question though – who on Earth is using Erlang? The answer may surprise you.
There was once a time when Cisco, Ericsson, Klarna, Goldman Sachs, T-Mobile, and Amazon kept a little secret. There was this little-known programming language called Erlang, that, as it turned out, was fantastic at controlling vast amounts of infrastructure like massive mobile phone networks.
It was a badly kept dirty little secret. At one time, 90% of all internet traffic that was being modulated and demodulated through routers and switchboards every day was running on Erlang. The beginnings of GPRS, then on to 3G, 4G and now, 5G – all Erlang all day.
WhatsApp and WeChat? Running on an Erlang heart, given its track record with communications software. Erlang is open source and has found a new home in blockchain and crypto mining frameworks because of its flexibility.
You like Super Mario? Nintendo has sold over 34 million Switch consoles to date, which run on an Erlang based messaging system to handle the millions of concurrent connections from users online at any one time. How about online gaming? Riot Games uses Erlang to manage almost 10 million players online at the same time, all competing in League of Legends.
2 – WHAT IS ERLANG:
As you might have already guessed, Erlang is a functional, fairly generic programming language that favors building scalable, concurrent systems that have the ability to scale up and provide high availability when spikes in user requests occur – all done without the risk of the system crashing.
Erlang was actually designed in the back end of the 80s at Ericsson for handling their telephone switchboards – so it’s not like it’s new or anything. A telephone switchboard back then was a complicated system, probably comparable to what the internet is to us in the modern day.
The main trait that sets Erlang apart from other programming languages is that it is process orientated. It’s a bunch of isolated, non-memory hungry processes that communicate with each other through messages. The receiving and processing of these messages in turn leads to the creation of new messages, sending the messages on to other messages, or changing the state of a message.
The system scales easily horizontally by adding more machines to the network, or vertically by adding more resources to each machine. It’s a functional language in the same vein as Scala and Haskell, with frequent use of pure functions, higher order functions and pattern matching.
3 – WHAT ERLANG IS USED FOR:
Erlang is used to write a system that governs a third-party gateway. It’s especially useful with things like SMS alert services where millions of messages shot out to users every day, and sometimes single word responses sent back that dictate how to proceed with certain actions – such as texting back yes or no to confirm a doctor’s appointment.
In this case, each message sent out by the system and received by the user is a different and individual process. The system therefore has to be able to use reason and logic to know what parameters are required for a message to be sent out, while at the same time handling the sheer scale up on a high number of new processes (new messages) that are constantly occurring.
This is particularly useful for something like a betting agency, on the day of the Super Bowl. As you would imagine, there would be a higher-than-average number of users sending concurrent and varying requests. A system is needed that can scale up to handle this increased volume without affecting reliability, while at the same time dancing around the fact that each bet put on will change the price of the odds pretty much every second. Scaling, concurrency, reliability.
4 – WHY ERLANG IS POPULAR:
Let’s take a slightly different perspective and take a look at the semantics and meaning behind the Erlang programming language – the meaning behind the functional, logic, and concurrent programming. It all combines to provide a higher level of abstraction – translating into less code and less maintenance, but with a net gain in expression.
Concurrency is the core building block and offers a logical way around a problem while still handling the implementation of a large number of systems which govern other things happening at the same time.
Think of it this way. The world is concurrent, and things in the world don’t share data they communicate with messages – also, things fail. Now apply this model to humans.
We’re biological organisms who don’t share a brain, who speak to each other in unscripted and spontaneous messages that often overlap each other. Other humans listen and process the messages – interpreting what they think is relevant or important to them.
Sometimes humans fail, in our case we get sick or pass away. The other humans around us continue with their work, until a new human is created to take their place, or the failed human is repaired.
This is a pretty accurate analogy of why Erlang is so useful, and why it’s so popular in handling systems with millions of concurrent users all doing different things at the same time.
5 – THE PROS & CONS:
KNOW YOUR ROLE:
Erlang can’t really be compared to other programming languages. It operates like a mini operating system, and performs extremely well in multi-server, node distributed applications – controlling a multi-node network.
As a monitoring system that can oversee and coordinate thousands of virtual machines, Erlang is almost scary in how well it performs the task. It’s actually hard to think of any other programming language you’d use for that particular application.
Erlang is sheer simplicity. Those with an idea about how to program functionally will love the syntax as it allows for writing in extremely simple code.
NOT AT FAULT:
High availability systems that experience huge spikes and wild variances in user requests will favor from using Erlang due to its fault tolerance and ability to still manage surrounding processes if one breaks down.
ALL ABOUT CONCURRENCY:
Scale and distribute Erlang, while scaling and distributing other programs within Erlang. Scale up, or scale sideways, dealer’s choice – the programming language is built for concurrency.
Every open-sourced programming language has an online community ready and willing to help. Sadly, certain individuals or small groups can be toxic and extremely unhelpful. Thankfully, Erlang has a small but very mature community who provide excellent support for those who ask nicely.
Erlang is also a double-edged sword in the sense that while it performs flawlessly for things like messenger apps and telecommunications exchanges, it’s not a general-purpose language and can’t be used for much else.
Erlang is designed to handle a huge number of minor tasks, and doesn’t cope well with things like computation heavy tasks, real time communications like live chat on a website, or string operations like parsers or transformers.
Those unfamiliar with Erlang may run into troubles with setting up and deploying Erlang applications. It’s one of those things that you need to have done before in order to provision the system properly.
New Erlang afficionados will have a hard time debugging the system as the error reporting isn’t the most user friendly of the bunch, and exception related errors can be tricky to diagnose.
NOT IN DEMAND:
Erlang programmers are one of those things – there aren’t a great deal around, and those who are, generally have work booked out well in advance. It can be hard to hire an Erlang specialist for your team due to the relative unpopularity and niche nature of Erlang.
WHAT’S IT REALLY LIKE?
So, to conclude, we’ll try to give you an idea of what working in Erlang is like.
Imagine you’re suddenly transported aboard an alien spaceship. The only way to escape would be to somehow reverse engineer the alien technology and controls, draw similarities between that and human logic and reasoning, and then eventually learn how to fly the ship.
So, Erlang’s a bit like that. But on the other hand, wouldn’t it be extremely cool if you upskilled and learned how to pilot a flying saucer? The answer is always – “yes”.
HOW TO GET STARTED
In our opinion, these are the 5 best online resources to learn Erlang. They range in detail and pace from beginner to veteran, but given you have to get into the Erlang headspace, best to start from the ground up.
1 – How I Start:
A great resource aimed at complete novices that outlines what Erlang is, and the whys and hows around its use.
2 – Stuff Goes Bad: Erlang in Anger:
A collection of tips and tricks gathered from many long time Erlang programmers that both beginners and veterans will fine handy. Sure, to prevent a lot of problems and issues from arising, and is a must read.
3 – Learn You Some Erlang for Great Good!
This is an awesome free online guide aimed at those with programming experience, but who aren’t super familiar with functional programming.
This is very short and sweet, aimed to deliver information to experienced programmers in a way that they can easily pick up – based on their assumed prior knowledge.
Erlang is the same as every other programming language in the sense that even seasoned veterans need a handy cheat sheet open to constantly refer back to from time to time. Save it into your browser!
We hope this blog helped you better understand Erlang and all it has to offer! If you enjoyed this blog you may also enjoy our other blogs like, Clojure and 5 Things You Need to Know About It or 7 Reasons Why VueJS is so Popular.
Kofi Group is proud to be a source of knowledge and insight into the startup software engineering world and offers a multitude of resources to help you learn more, improve your career, and help startups hire the best talent. If you are interested in learning more about what we do and how we can help you then get in touch or watch our Youtube videos for additional information.