Blog

Why Scala is our first choice for backends

An article from the field of Cap3 insights, software development
Dr. Nikita Danilenko
09.11.2020
Dr. Nikita Danilenko

TL;DR

Scala is a great tool for backends, because it

  • is a statically typed, expressive, safe language
  • supports and encourages good practices
  • is evolving, and adapting

Let's elaborate

If you search for 'Reasons for Scala' you will find various excellent articles, describing

Indeed, with so many developers and companies using Scala, let's have a look at why Scala is a great fit for most of our projects.

Typed, expressive, safe

Scala provides numerous concepts that allow domain specific aspects to be implemented in a simple, straightforward fashion. The transition from direct class instantiation to the construction of a class with complex constraints is very fluid, and natural - both are realised through function applications.

Combined with the fact that Scala is strongly statically typed, a natural approach to writing software is to provide dedicated types for the various domain aspects and to define functions that have clearly delimited responsibilities. The support for extending existing structures with new cases is very good, and the compiler will make your life easier by warning you if any cases are missing.

In general, the old functional adage "Think about what you want to do, rather than how to do it" is deeply inscribed into the language and its libraries, thus providing a streamlined and pleasant programming experience.

Good practices - purity and pragmatism

Scala offers great support for established practices and patterns, while avoiding being too zealous. For instance, discouraging mutability is a good idea in general, but on some occasions mutability might be exactly what you need. Encouraging the one, but still allowing the other is a good balance, and a great approach to pragmatic development.

Scala supports techniques of functional programming both in the language itself and on the library level. While it is possible to stick to purely functional concepts, it is often convenient and practical to deviate a little from time to time. One common example is that certain structures may technically violate laws, but are lawful in all relevant applications. The corresponding libraries then provide support for possibly unlawful structures and allow using the desired abstractions at one's own discretion.

Additionally, a general pattern in many libraries is the drive to be practical and convenient. There is usually a good collection of useful functions and those that may be missing, are simple to define in terms of the existing ones.

Growth and evolution

The language itself is evolving, libraries are being improved constantly and there is a lively community of developers, who strive together to make the language experience as productive and positive as possible.

Apart from the language and its own libraries there is also a frictionless access to all Java libraries and their eco-system. The Java interoperability comes with the additional advantage of being able to keep existing Java code and build a Scala extension around it.

With Scala 3 around the corner, a large team effort to greatly improve the language is about to be released. We are excited about the coming changes and are looking forward to developing more great quality software in Scala!

Dr. Nikita Danilenko
09.11.2020
Dr. Nikita Danilenko
Arrow bottom left

Interested in our work? Contact us!

You'd like to start a software project with us or talk about your idea for a start? Drop us a note; we're happy to answer all your questions.

Non-binding project request

* Mandatory