So many languages and so little time. We usually aim to gain professional expertise by climbing up on the learning curve. We crave for being confident in the technology of our choice. Have you ever asked yourself what comes next? Is there any hilltop out there? Is there any sense of learning something new? Whenever I face such a dilemma, I read out Albert Einstein’s motto: _Life is like riding a bicycle, to keep your balance, you must keep moving._ Let me tell you my story based on true events.
I’ve spent recent years coding with Node.js. At some point, I realised there are so many other technologies to discover. I considered several options reviewing blogs, forums and surveys. I knew that I needed a language that would correspond to my skills and experience. I decided to explore the world of functional programming. It was like a promise of better performance and productivity. I then asked myself - "Why not try Elixir"? I wanted to build scalable web applications that are reliable, fault-tolerant and efficient.
Philosophy Of Learning A New Language
Programming is nothing more than transforming human thoughts into a computer code. Language is nothing less than a tool that makes it work. Professionals are those who have a variety of options at hand and know when and how to apply them.
During my personal quest for new technologies, I discovered a very interesting video. It presents the values of programming vocabulary. If you haven't heard about Mikael Muszyński from Erlang Solutions, it is high time to explore his online publications. The video starts with a synopsis of the philosophy behind learning new languages. The choice is usually between two road paths. The first is the language that you already know and use. It guarantees a steady workflow and comfort. The other is all about challenge, inspiration and experiment. The second option has the potential of exploring new territories. It doesn’t mean you have to move away from where you came from. New techniques allow you to look at old problems from a new perspective. They enhance the range of your resources and increase your business value. It’s an investment of time with a high return rate.
You may say you enjoy programming and you do it for fun. If you chose it to be your profession, you need to be aware that it is your skill that allows bringing home the bacon. Your job is not only to write the code. It is to create products and services for your company and your clients.
Finally, taking up a new language gives you a chance to code like a complete newbie. Trust me, there’s nothing scary in that. It’s like with learning how to drive a lorry. You know how to operate a car, it’s just about cracking another piece of code.
Where Theory Meets Practice - Why Elixir Sounds Like A Plan
Elixir and Phoenix attract more and more developers these days. It may be a bold statement or a surprise to you, but the facts support it in full. According to 2019 Developer Survey, Elixir programmers are now one of the best-paid software engineers. They reach the top 5 in the Top Paying Technologies category. That’s impressive, taking into account we got used to considering it as a niche language. Moreover, Elixir has been one of the main actors starring in InfoQ Trends Report published this month. It entered the Programming Language trend list as Innovator which is the start-up stage of the Technology Adoption Life Cycle. The term sounds remarkable but what does it refer to? Let's have a look at a hi-tech bestseller: Crossing the Chasm. The author, Geoffrey Moore, defines Innovators as early markets. They are full of technology enthusiasts and visionaries. All this perfectly match the pattern of the new language's philosophy mentioned a few paragraphs ago.
Does it mean that other technology stacks like Node.js should be put on the shelf? Not at all, it’s all about the goal you want to achieve and the product you create. Node.js may work well as long as you don’t use it for CPU intensive operations. It doesn’t seem to be a good tool to craft scalable applications. You need to remember it is single-threaded after all. Thus, it utilizes only one CPU core at a time. When you experience the pain of blocking operations, the best way forward is simple. You start looking for alternative solutions with no hard feelings.
Functional programming brings several benefits for web developers, businesses and consumers. Most of all, Elixir and Phoenix seem to be a perfect fix for major bottlenecks and performance issues that technology faces these days. Recent Case Study confirms it does a very good job when it comes to boosting application effectiveness. It contributes to the end-user experience and thus enhances the commercial profit. Once you burn some midnight oil, you can improve problem-solving skills. You get a chance to become a better programmer in languages you already use.
A Solid Framework And Libraries
Node.js libraries contain numerous hosts of functions. They originate from other repositories and C++ binaries. If you don’t have good documentation for a given library, the work with it is certainly not any pleasure. What’s more, Node.js is a lightweight environment but it comes with a price. You may need to download hundreds of external libraries, even for a small project. To explore this problem deeper, I recently compared Phoenix and Express. I wanted to evaluate which one provides better packages and documentation. Official website praises Express for being flexible and minimal. These features may sound like an advantage to you, but in fact, they turn into a double-edged sword. To create product effectively with Node.js and Express, you need a set of middleware packages. Without them, you simply open your app to exploits and may not be able to handle security headers, user logins or even cookies. Unfortunately, finding the right package very often takes time and patience. It resembles assembling Lego pieces that are all over the place. Phoenix, on the other hand, has a wonderful set of built-in packages. Instead of struggling with misplaced blocks, you can use a clear manual.
Async Tasks - Node.Js Bull vs Elixir Dynamic Supervisors
Both Elixir and Node.Js offer solutions for asynchronous programming. Bull may be good for managing the background jobs in Node.js and handling concurrency. Keeping the computation separate from the webserver is in fact necessary to keep the latter responsive. I often ask myself why we make things complicated if there are better solutions at hand. That’s why I personally prefer Elixir and its fault-tolerance paradigm. I like the way it handles concurrency. It does magic when it comes to processing big data sets or communicating with external API. Also, Elixir comes with an Open Telecom Platform (OTP) which provides a variety of concurrency patterns and protocols. Dynamic Supervisors and GenServers allow you to build fast and concurrent workflows. All you need is to add your functions into callbacks. Elixir library will add a new function into the module. It will either accept the arguments and return with a confirmation or with an error if the input is invalid.
External dependencies go with every project you create. Node.js operates on a variety of libraries (e.g. V8) and tools (e.g. npm). Such a wide range of solutions may actually cause a headache. Sometimes, it’s a real challenge to choose the best available option. Considering the pros and cons of every library or package takes time ... and time is money. From my perspective, Elixir provides a more efficient solution. You can pull all external dependencies from Hex – a package manager that is usable out of the box in Elixir. In addition, Mix – a built-in module responsible for project configuration manages all dependencies. They are automatically compiled and updated, all done behind the scenes. As a result, you don’t have to worry about this side of the project.
Elixir Releases - A New Quality
Elixir v1.9 comes with a bonus – a self-contained directory called releases. This feature is a true gem. It allows the precompiling of entire application code, dependencies and runtime. All these are then packed into one single unit. Releases do not require a source code within production artefact. You don’t even need Elixir on your servers. Erlang VM and its runtime are enclosed by default. Moreover, standard libraries are limited to remove any unnecessary parts.
Your Key to Success
I aimed to introduce you into a great mystery of acquiring knowledge and lifelong learning. The handbook to your success should actually contain one single sentence: _Turn your language skills into a unique competitive advantage_. It is not about possessing a key that opens one door. You need to have a set of instruments that unlocks every gate and know how to use them. It is the universal truth I learned and share with you today. I am more than happy to learn about your experience with Elixir.
If you are a CTO, business or product owner, contact me here. You will get advice on how to craft your service or improve its performance with custom-made technology.