Why Divvy uses Elixir instead of more popular coding languages.

Divvy
4 min readApr 2, 2019

--

By Clinton De Young, Senior Software Engineer

Elixir At Divvy

At Divvy, we build a business-oriented payment platform that helps companies manage their budgets and expenses, eliminates fraud and reduces wasteful spending. Our customers rely on Divvy for their financial success; therefore, our software must be robust, secure, scalable, and available whenever our customers need it. As we started building our service, we knew we needed a language that could provide us with an unshakable foundation for our application and that could easily scale with us as we grew. To meet our needs, and the needs of our customers, we chose to develop our business using Elixir.

Below are some of the features and benefits Elixir offers that have contributed to our success.

Concurrency

Elixir uses the actor model for concurrency. This model, coupled with Elixir’s functional nature, provide us with both stability and ease of development. Developers don’t have to worry about protecting object state and can rely on Elixir’s functional paradigm to ensure that, given the same inputs, the outputs of our system will remain consistent.

Under its expressive and easy-to-read syntax, Elixir uses lightweight “green” processes that take significantly less memory than other languages, like Go. These processes are protected from each other in private memory and are immune to many of the bugs that are inherent in systems using public memory for multithreaded applications. Elixir also uses cooperative scheduling, instead of preemptive scheduling, which means all Elixir processes are guaranteed a predefined window of execution. This differs from languages, like Go, that use preemptive scheduling, where runaway processes can prevent other processes from running. Elixir’s concurrency model has allowed Divvy to create a platform that is fast and responsive, and also customer data from many of the data-corrupting bugs that occur in other popular concurrent languages.

Scalability

Elixir and its OTP library make it easy to run software across multiple servers,

virtual machines, or containers; all communicating flawlessly with each other. Elixir also makes efficient use of server resources. This means Elixir can perform the same tasks as languages like Python, PHP, and Ruby using approximately 1/5th the infrastructure.

As Divvy grows, it is relatively easy to add more servers and increase our ability to handle an ever-growing customer base. The ability to run our platform across multiple servers in a distributed system offer us better application performance, and Elixir’s optimized use of system resources allows us to serve our customers with less overhead.

Fault Tolerance

Elixir’s functional paradigm, private processes, and supervision trees make it extremely fault tolerance. So much so that Elixir programmers follow a “Let it crash!” philosophy. In other languages, like Java, a crash in one thread is likely to take down all the other threads currently running that same code, potentially affecting all the users of the system. To prevent this, Java programmers have to employ a complex system of error-handling to ensure the system can deal with crashes gracefully. In Elixir, a crash in one process will be contained to that process, so only one user will be affected. Furthermore, Elixir is able to restart crashed processes by using supervision trees; which are processes that monitor other processes and make sure they remain active.

By using Elixir, Divvy is able to ensure that a problem with one customer is going to stay localized to that customer; leaving our other customers unaffected. In most cases, the system will be able to “heal” itself and allow that customer to continue on with their work.

Ease and Speed of Development

One of the ways software companies can maintain a competitive edge is through the speed of development. Elixir provides an expressive, efficient, clean, and easy-to-read syntax that helps us deliver new features faster.

As previously mentioned, Elixir eliminates the need for handling exceptions and many of the issues related to state management. Elixir also comes with mature, well-thought-out tooling that simplifies deployments, assists developers in modeling new features, and makes database changes easy.

Elixir allows Divvy developers to create and deploy features at a quicker pace. It makes us more agile than we would be using more bloated and verbose languages, like Java. Elixir allows us to meet our customers’ needs in a timely manner and ensures we can remain ahead of our competitors.

Why we Chose Elixir

Divvy chose Elixir because we want to create the best and most feature-rich software we can; we want to create a spectacular and performant user experience; we want to scale to meet the needs of businesses around the world, and we want to be the market leader in business-oriented payments. Elixir makes this all possible.

--

--

Divvy

The most secure financial platform for businesses to manage payments and subscriptions, build strategic budgets, and eliminate expense reports. getdivvy.com