How Memo Bank designs and builds digital products.
Written by Jérémie Martinez
In the banking industry, data is everything. It has to be traced, consolidated, monitored, verified and verified again. In fact, banks cannot afford to lose any data or even to have the tiniest mistake in their operations. After all, you have to earn people’s trust before they trust you to keep their money.
Basically, banks use this data in two main ways:
- in real-time to handle transactions;
- in batch to respond to automatic and daily tasks like reporting, settlement or accountability.
This data is processed, stored and mainly used in a system called Core Banking System (CBS) which can be seen as the heart of a bank. This system is in charge of running all the internal machinery and making sure that everything is in order and under control.
Additionally, data can quickly become massive. As a result, CBS must accept a large volume of data with top performance. A CBS must also be available at any time. While it is the case for all systems, this is particularly true in the banking world because of specific regulations.
To address these constraints, we made the choice to develop our CBS and all our other backend applications in Elixir.
What is Elixir?
Elixir is a dynamic, functional language designed for building scalable and maintainable applications…
Elixir has been created in 2011 by José Valim. After falling in love with Erlang, José was still missing first-class support from some features of most recent programming languages. Elixir was born.
Since then, the community and the ecosystem kept growing and Elixir is today a top alternative.
Let’s dive into what makes Elixir so great!
Trusting data flows
In a bank, a single transaction can quickly represent hundreds of processes to be managed by different modules of the CBS. Functional programming has been proven to be an amazing approach when handling such complex data flows. Additionally, most modern languages are going down this road and it has many advantages, including:
- Stateless to avoid and reduce as many side effects as possible. It helps developers to write clean, simple and composable functions, which ease maintenance, debugging and refactoring;
- Immutable by design. It helps to make sure data is not altered or lost. Thus, scenarios can be replayed and verified;
- Highly testable with its pure function approach. It is key in such a complex system and truly mandatory for a bank which needs a 100% reliable and robust system.
This paradigm quickly became an obvious choice for us. Of course, Elixir is not the only functional programming language on the market but it has all the nice features which make functional programming an asset. Besides, it comes with a lot of features inspired by other languages: modern syntax, metaprogramming, polymorphism, actor model, etc.
A good trade-off between performances and high level features
Elixir is built upon Erlang. More precisely, it compiles to byte-code compatible with the Erlang VM (BEAM), which makes it 100% interoperable with Erlang, its performances and its ecosystem. It is based on top of a well-known concurrency model that is now a standard while designing highly scalable and distributed systems: the actor model.
The Erlang VM runs in companies with high performance needs like WhatsApp, Netflix, Pinterest and 50% of the European telecommunication system. Just that…
Finally, Erlang is part of the exclusive club of the nine nines languages which makes it one of the most available and reliable platform out there.
If you are into figures (and not the ones of your balance), some benchmarks are available to prove Elixir’s performance and ability to handle huge traffics.
Even if languages with better performances exist, Elixir is a good tradeoff between pure performances and high level features. It won’t build the perfect CBS for us but we believe it will help us reach the level of scalability and availability that our system requires to absorb real-time transactions.
A growing and solid community
When it comes to a new language, most developers are afraid of tooling, IDE integration, and finding this specific library you wish you never had to write.
As we saw earlier, Elixir is totally interoperable with Erlang and its VM. Thus, any tool written for Erlang can be used on an Elixir codebase.
Even if Elixir and its community are young, they created amazing open-source libraries. Two obvious examples are:
- Phoenix, a modern and intuitive approach to web application development which is inspired by the best existing frameworks (Ruby on Rails, Play Framework, etc.). It provides a great architecture and an intuitive DSL that helps with productivity and maintainability;
- Ecto, a perfect example of a library which takes full advantage of the power and the expressiveness of Elixir. Ecto is an efficient database wrapper which benefits from the performances of the agent model. It also provides language-integrated queries with a beautiful DSL thanks to macros.
Finally, the community took care of providing first-class support for most of the IDEs: Atom, IntelliJ, Sublime Text, etc. Without judging you, Elixir will make you feel home.
Building a CBS is not an easy task but we will rely on the 20 years of tooling done by the Erlang community. We will also embrace Elixir approach and the amazing libraries it can provide. Erlang and Elixir ecosystems really felt like a shortcut for us.
A fault tolerant approach
If there are any errors, the process is automatically terminated, and this is reported to any processes that were monitoring the crashed process.
Every time we develop a software application, one of the problems we always face is error management.
Erlang and Elixir come with a great approach which became a philosophy: “Let it crash”. It means that any system should crash as soon as possible if it enters a faulty state. The most important part is not about crashing but how well we react to this crash. The whole system must not crash and we have to be able to detect the crash if we want to adopt the right strategy. It might look easy but any experienced software developer knows it can quickly become a nightmare.
Fortunately, Elixir has all the right tools to solve these problems. It has a robust supervision that will enable processes to watch other processes and act upon failures (restarting, cancelling, triggering an alarm, etc.). As Erlang developers say: a well-designed application is a hierarchy of supervisor and worker processes, with a top-level supervisor process.
Thanks to concepts like OTP and umbrella application, Elixir will empower developers to help them write easy-to-split, easy-to-move and easy-to-communicate modules which will live together, discuss but never impact each other in case of crashes. One could say that Elixir is particularly great for a monolith first approach since it will be easier to go micro-services later.
Once again, this “Let it crash” philosophy will be an asset when designing our CBS since the platform will enforce good practices and provide all the tools required to make our bank a rock-solid system with great availability, smart error handling and reliable data flows.
Building a team
We are a startup and building a team is a very important topic. So being able to hire experienced developers that will be interested in the language we chose is a real challenge. At the same time, we deeply believe that being a good developer goes beyond a simple language and we are ready to recruit engineers who can adapt, develop skills and quickly become productive with this technology.
This is why we liked Elixir: the language itself has many assets to make the transition easier. First, the functional paradigm is already being used by many other modern languages such as Clojure, Scala, etc. Then, its syntax is very close to common languages like Ruby for example. Finally, Phoenix’s approach is strongly inspired by frameworks like Ruby on Rails or Play, allowing some developers to keep their (good) reflexes.
One of the key aspects that reassured us from a recruitment perspective is that Elixir wants to gather the best of the languages that preceded it. As a result, it will interest many communities and their developers.
By choosing Elixir we know that we are not taking the most obvious path but we are deeply convinced that it will be a successful bet. We believe in its capabilities and its community to help us create our bank for businesses.
We hope this article will make our choice clearer and have aroused interest about our future developments.
Last but not least, if you happen to be in Paris (or happy to relocate) with a crazy and irresistible urge to learn, write and ship code in Elixir: let’s talk!