Our rationale for selecting Scala as the language for building the server applications.
We needed a programming language to power the LineDrop platform’s three types of server applications:
Knowing that the platform will span multiple projects, having fewer languages would make system maintenance much easier in the long run. Scala came up as a natural choice because it could elegantly support web applications and services with the use of a lightweight Play Framework as well as crunch the large incoming datasets with its functional programming techniques.
Scala is based on Java and thus can utilize Java libraries with little or no work. It is a concise language, which is helpful when dealing with multiple projects. Scala projects are easy to deploy and run on OpenJDK which allows us to use Linux VMs as servers.
Comparing to C# with .NET and Ruby on Rails, Scala and Play Framework has been the most straightforward web application building platform allowing the most amount of control and reliability, at least in our experience. To share how easy it was to build a web application with Scala and Play, we had published the Ultimate Guide to Building a Web Application with Play and Scala.
On the large dataset crunching side, Scala provides some nifty functional programming tricks to speed up writing computational code. For example, take a look how we can find the date of a first subscription event:
Values in the subscriber map are reduced to the left, meaning that when the comparison function is executed, only the value on to the left of the equal sign remains. In this case, the function compares two adjacent objects by taking milliseconds of the timestamp of object creation. Once the values are reduced, a single subscriber object is produced. Using the created property of the object, the date is assigned to starting_date.
Generally speaking, it is difficult to choose one programming language over another for a particular project, and that decision often really depends on the coder’s experience.
However, in a multi-project environment, if a single language meets all application requirements and is also fun to learn, the choice is much easier to make. We made our choice, and it is Scala.
Artwork by: Photo by Alex on Unsplash
Browse related articles