By Paweł Hajduk | March 15, 2018
Erlang vs Node.js & Java
Most of the software being developed these days is implemented using Node.js or Java. Ten years ago, around 2006-2009 you would say: Java or Ruby on Rails. No matter how far you look backwards, answer would never contain Erlang. Question is, why? Is it because it’s a functional language? Maybe because it’s old? It’s a hard question but I believe that Erlang is not just a general purpose language. In other words, it shines in specific business problems and believe me, it shines a lot.
Does language matter?
Junior developer would answer:
“Of course it matters. I know only Java and Spring framework. I can implement CRUD endpoint using those tools in one day. I can’t do it in Node.js”
Medium developer would answer:
“Technology doesn’t matter. I can pick Java, Node.js and I can implement CRUD endpoint in one, maybe two, days and it will work in same way.”
Senior developer would answer:
Why “it depends”? Does language matter? Do tools matter? Yes, they do.
Use case: REST API for mobile
Imagine you have a software product. It works well as an app in the browser, but you want to go mobile. So you need to implement REST API. It doesn’t make sense to pick Erlang in this case. You can implement MVP in few days (maybe even hours) using Java or Node.js. If you architect your solution well, you can implement scalable solution in first shot. So when does Erlang make sense?
Use case: messaging or gathering data from multiple devices
OK, you have a product with mobile apps. Imagine you want to implement messaging service well tailored to your needs. Maybe you want to implement endpoint to receive real-time data from unknown number of mobile devices. In other words: you want to process tons of data fast. Erlang is hard to beat here. Erlang based solutions scale pretty well and actor model , which is literally embedded into language, perfectly fits here.
What do I mean by “perfectly fits here”? It’s simple: code you have to write is shorter. Scaling system is easier. Debugging and diagnosing your production system is awesome.
Shorter, easier, awesome
Shorter code - Erlang is concise. I love Erlang for it. Syntax is pretty specific but after 3-4 weeks it’s natural as any other. Remember about First Law of Software Quality:
In Erlang you can write almost procedural code which is easy to follow and understand. Functional nature of Erlang reduces number of control statements.
Easier scaling - Erlang is distributed by default. Concept of nodes, actors and messages force developer to write code which scales pretty well.
Awesome debugging - you can attach to production software. You define what method you want to observe and you get results immediately. We described details of tracing in different article but in a nutshell: you can see what arguments were passed to function and what’s the output. Flexibility and ease of use is priceless from debugging perspective. In most cases you don’t even t need logs to verify what’s going on. Even more, logs present past. Here you can debug and analyze real-time data.
Business + Elixir/Erlang = Pattern Matched
If you want to hire good Erlang developers, brace yourself. They are hidden and enjoy they work. Why? Working with Erlang is fun. Usually software is distributed, handles big amount of traffic and scales well. What is better for developer who cares about produced software? There’s no bigger gratitude than monitoring how Auto Scaling Group launch new instance, such instance reduces your per host traffic in linear manner and everything works well.
We can help you write scalable solutions hosted in public cloud. We hire only engineers with 8+ year of experience. We are experienced in many languages and tech stacks. We are happy to help you architect, prototype, implement and scale your software.
Veteran Elixir/Erlang Team Available
Considering to use Elixir or Erlang to build your new product?
Partner with our full-stack development team to design and develop a tailored product or improve your existing solution.