kafka stream scala

Why does Scala win against Kotlin? Senior engineer’s opinion

kafka stream scala

This article is based on a story of one of our developers, ex Java now Scala developer, who decided to follow the Scala path because he found writing in Scala and being part of a Scala Development Company extremely developing and interesting.

Scala programming is definitely one of the main topics that come to mind when it comes to Scalac (the name itself is actually Scala + C = Scala compiler and we’re a Scala development company in the very core). As you can probably tell from the name of our brand, before we developed teams like Data Engineers, DevOps, UX/UI and Frontend, our company was powered by Scala experts – even now, we are one of the biggest Scala development company in the world, and a Gold Lightbend Partner. 

Some time ago I started wondering; what is it about Scala that developers prefer over other languages? Why do we need Scala?  This post was originally meant to be focusing on Scala vs Kotlin comparison – so we interviewed our senior engineer (who was previously a Java engineer) just to find out, that there is a way better story to tell – about how Scala makes Developers enjoy their work again. Let me take you on a journey to discover the ultimate truth! 

On the first day, there was Java 

Java was developed in the early 1990s and it changed the whole IT world. In the early 90s, the idea of extending the power of network computing to the activities of everyday life was something totally abstract. Today, with technology being such a great part of our daily lives, we take it for granted. As a matter of fact, Java is still, after all these years, an engine that runs many applications – from games to business solutions.

The real question is: is Java enough?


The slow evolution of the Java programming language has led to quite a few inventions in the JVM programming languages. As a result, there are over 50 JVM languages! They were all created to fill in the gaps in existing versions of Java by developers who didn’t settle on “good enough”. 

In theory, Java can be used for everything –  a mobile app, a server, an e-commerce platform. In practice – iif you want a mobile app you’re better off with Kotlin, and if anything regarding your solution is more complex and requires a big amount of data Scala is a way to go.

On the second day, there was Kotlin

Sorry to have to put it this way but Kotlin is just Java in a nicer package – still an object-oriented language but fresher and funkier. It’s so similar that it doesn’t require a different mindset. Java developers are able to quickly switch to Kotlin and program smoothly in it. You can also call Java code from Kotlin and vice versa without any hassle. 

Moreover, apart from that, it has several other advantages, such as the way the collection library is built, support for nulls, and coroutines. Kotlin supports functional constructions, but it is still closer to Java deprived of its old-fashioned legacy than to Scala. It gives Java programmers freshness and constructions that are not available in Java, as well as brevity in expressing thoughts through code.

Kotlin’s domain in contrast to Scala is mobile. It can be used for both server and client (mobile) development – Frontend and Backend. Android supports Kotlin out of the box. You can also use Scala for that purpose but it is not as hassle-free as Kotlin.

Scala vs Kotlin popularity
Scala vs Kotlin popularity in USA
Source: Google Trends

I chose Scala as a junior because in a way it can be easy to start with.
You don’t have to jump straight into object-oriented programming (it can be introduced in a procedural paradigm at first), but at the same time, it has all the necessary concepts to learn it. You can move over to functional programming without having to switch to other functional languages. Scala also shares C-like familiarities so it’s easy to learn C-style languages too. 

Patryk Kirszenstein,
Junior Scala Developer 

and on the third day… there was Scala

As mentioned before, some Java developers knew that they couldn’t quite settle for what they had. They wanted more. They were looking for an alternative, where nicer syntax could be used. 

Scala as a programming language with functional facilities requires a different mindset and much more knowledge than Java or Kotlin because of the fact that, among other things, code is written differently.

In Scala, you can write functional and object-oriented code. It has a very rich syntax that enables you to write code in many ways. This is also why people who are not involved with Scala may have the impression that it’s over-complicated. This is because, in the case of Java and Kotlin, programmers know what to expect. With languages like Scala – you go big or you go home. 

Systems written in strongly typed languages like Scala are easier to maintain in the long term. Also, a big business-related advantage is that it’s a JVM compiled language so you can use all the existing Java libraries. Did you know that Scala, although not so popular as Java, it’s also used by world-wide enterprises which seems to see its advantages like Zalando, LinkedIn, Twitter, Foursquare, Netflix, Tumblr, Walmart, Paypal, Intel and Samsung?.


What are the business reasons to use Scala?

If you’re working with complex environments, applications, analytics it’s way more efficient than Java or Kotlin. Scala is used to implement Spark (the leading platform for distributed data processing)  as well as to define the computations themselves, so it’s really data-scientist-friendly. Not to mention that Scala is a great language for domains like Machine Learning and Blockchain which are extremely important in today’s business, and will become even more significant in the future. 

 

Scala is pure 

Challenges may be the key to why Scala has such a big community – especially for a seemingly niche language – with over 95 919 questions asked solely about Scala on StackOverflow (not to mention related topics).

Scala is a powerful language with highly-advantageous features and flexible syntax. But, it is quite difficult for developers to get a grip on this JVM programming language. However, with time, it becomes really natural and straightforward. What Scala represents, with its functional approach, is passion-driven work leading to pure self-development. To fall in love with it, you need to first start writing in it, and then dig a little deeper. Scratching the surface may only give you the wrong idea. 

Dorian Sarnowski Scala Engineer Developer Expert

“While many languages share some of Scala’s features, few share so many of them, making Scala unique in ease of development.

Dorian Sarnowski,
Senior Scala developer 

As a Scala development company – we use Scala for a variety of reasons, which mostly come down to reducing development time and reducing the number of bugs in code. While many languages share some of Scala’s features, few share so many of them, making Scala unique in ease of development.

Scala – simply beautiful.

Scala really encourages switching from mutable data structures to immutable, and from regular methods to pure functions (without getting crazy about it like Haskell).  It’s simply beautiful. It provides a good balance between the conciseness of a language, extensibility, and performance. Keeping to JVM’s paradigm promise of “write once, run anywhere”, and combining it with functional coding, Scala lets you build the best of both worlds in your code.

It’s functional

I don’t think there is any programmer who wouldn’t find Functional Programming interesting, but sometimes they just let it go because they have other priorities at work. Fortunately, some jobs actually let you do exactly that for a living and that’s quite amazing. 

Scala is a very appealing choice for developers who are looking to strike a balance between writing pure code and writing solid code quickly – by building upon existing solutions and libraries when available. That  – combined with interoperability with the Java ecosystem and the JVM – makes Scala look very promising.

Scala is more influenced by functional programming languages like Haskell than Kotlin. It encourages the use of functional coding along with some additional features such as pattern matching and currying. Not only that,  but functional programming is also more substantial in the Scala environment. 

“Scala lets you build the best of both worlds in your code.

It’s love

Scala is functional and type-safe, but you encounter the difficulties progressively (you can still write Java-like code), so at no point will you get bored. It’s more likely you will feel like you are always on an intellectual adrenaline rush. You could poetically compare it to the feeling of falling in love for the first time. I think that’s truly one of the reasons Scala is definitely worth the time you will need to learn it. It will change the way you think forever. 

Share some love for Scala in the comments and feel free to ask any questions.

Check out other Scala-related articles on our blog:

Scale fast with Scalac – Scala development company ready to solve all your challenges.

Download e-book:

Scalac Case Study Book

Download now

Authors

Daria Karasek
Daria Karasek

Marketing Hero at Scalac. I strongly believe in creating opportunities rather than waiting for them to come. As befits Scalac team member I'm a hard worker, I always try to do the right thing and have a lot of fun! I'm an awesome friend and content writer, in that order. When I'm out of the office, I love to cook delicious Italian food and play board games with my friends. #boardgamegeek

Latest Blogposts

14.03.2024 / By  Dawid Jóźwiak

Implementing cloud VPN solution using AWS, Linux and WireGuard

Implementing cloud VPN solution using AWS, Linux and WireGuard

What is a VPN, and why is it important? A Virtual Private Network, or VPN in short, is a tunnel which handles all the internet data sent and received between Point A (typically an end-user) and Point B (application, server, or another end-user). This is done with security and privacy in mind, because it effectively […]

07.03.2024 / By  Bartosz Puszczyk

Building application with AI: from concept to prototype.

Blogpost About Building an application with the power of AI.

Introduction – Artificial Intelligence in Application Development When a few years ago the technological world was taken over by the blockchain trend, I must admit that I didn’t hop on that train. I couldn’t see the real value that this technology could bring to someone designing application interfaces. However, when the general public got to […]

28.02.2024 / By  Matylda Kamińska

Scalendar March 2024

scalendar march 2024

Event-driven Newsletter In the rapidly evolving world of software development, staying in line with the latest trends, technologies, and community gatherings is crucial for professionals seeking to enhance their skills and network. Scalendar serves as your comprehensive guide to navigate events scheduled worldwide, from specialized Scala conferences in March 2024 to broader gatherings on software […]

software product development

Need a successful project?

Estimate project