📜 ⬆️ ⬇️

Scala or not Scala? That is the question



The debate around Scala has not subsided for many years, turning mainly on the field of confrontation with Java. Indeed, despite the common platform, the languages ​​are different.

The arguments for Scala are known:
')
1. Scala is concise;
2. Scala functional;
3. Scala is cool and modern;

In response to the fact that Scala is slowly bending down, Martin Oderski stated the following : “In 2015, there was a lull, but in 2016, the development of Scala should accelerate.”

In this post I will not dive deep into the technical discussion, there are many experts who will make it better than me. Today we will talk about whether the developer needs Scala for self-development , for this I want to offer you a translation of the article by Matthew Casperson.

Well, in the end I will give a couple of links to popular articles on the topic over the past few years, if you suddenly missed some of them.

Every time, getting out of my Java-cave, I stumble upon some experienced developer who has mastered Scala. What is interesting, none of them seem to be planning to return to Java programming.

Having moved to Java 8 and having mastered Optional and Stream, I begin to understand the attractiveness of the functional approach. When I see how a nested for loop iterates over a collection or a stack of checks for null in the class hierarchy, it distorts me a bit ... Not so much because such code is simply ugly, but because until recently I he did not know anything better.

All this led me to the idea of ​​investing a certain (significant) time in learning a real functional language, such as Scala. The question is whether?

FOR: Scala is one of the few functional languages ​​that you will be paid to develop


If you skim through Scala jobs, you can see that commercial projects are starting to use this PL. This is despite the fact that vacancies for Clojure and OCaml are not in my city at all, and Erlang, Kotlin and Haskell return one vacancy each (usually as an additional skill). It is worth noting here that Scala, in any case, is claimed as the primary competence.

(note: In St. Petersburg, at the time of the translation of Article 61, Scala, Erlang and Kotlin have vacancies of 22 and 11, respectively, and the other languages ​​listed do show a minimum of vacancies ).



FOR: If the company uses Scala, you can be confident in their serious approach to development


To be honest, I haven’t yet seen inspirational jobs for Java developers. Reading these ads, you can smell the raw basement, in which you will grind out code in order to have something to write in the report, or on the knee to collect another CRUD web application.

If you see Scala as a candidate requirement, it means that at least someone thought and didn’t stop at default Java. This is a good bell, saying that the guys take programming seriously.

PRO: Even if you stay in Java, you will become the best developer.


Why is this variable not final? Could it be better to return a new object and not modify an existing one? Is this return optional or not? All these questions I asked myself when I wrote in Java because of my poor understanding of functional programming. By answering these questions, I improved my code.

Even if I cannot write to Scala, knowledge of Scala will only affect my code positively, even if this code is written in Java.

AGAINST: Scala is one of an infinite number of things that you can learn.


Will the study of Scala be the best investment of my time, given that the developer has a list of possible competencies tends to infinity? I can spend time exploring Scala, and maybe it would be better to study all the pitfalls of working with cloud platforms like AWS? Or is it worth studying the logic of processing Big Data? Or maybe we should look towards OWASP Top-10 or administering Linux systems? Or do this new javascript javascript?

By asking an experienced Java and Scala-developer to solve a problem, you will most likely get two different solutions. However, in both cases, you will get solutions, since neither Scala nor Java provides a substantially unique way to get a computer to do what computers do.

However, try to remember the last time when your responsibilities as a developer ended, at the time of successful compilation of the code?

AGAINST: Scala can just "punch ice" for languages ​​like Kotlin


Kotlin has yet to take off (as of May 2016, it has not even entered the TOP-50 of the TIOBE index), but I’m willing to bet that Kotlin will become the key functional programming language on the JVM in the next few years.

The language is being developed by JetBrains, so tooling for it will be a slaughter anyway. Kotlin develops from the requirements of the industry, not from academic fabrications. By the end of this year, I think Kotlin will equal Scala in terms of the number of available vacancies.

AGAINST: Is functional Java good enough?


Programming on functional Java will give a code that will be sufficiently understandable and read for a huge number of other Java developers from around the world, and you will not have a headache about translating the company and existing developers into a new language. In the end, Java 8 will give you functional support right in the language.

Yes, this will not be a pure functional approach, and you will not have the right to show off Higher Kinded Types . Or maybe you just get 80% of the benefits of using 20% ​​of the functional coding features?

There are no easy answers.


I am torn between the obvious advantages of Scala's deep understanding, the broadening of the outlook in the field of IT ecosystems and the practical advantages presented by competing young languages.




And useful links for Java vs Scala holivar:

1. How to switch from Java to Scala ;
2. Scala is worse than Java ;
3. Yes, Virginia, Scala is complicated!
4. As a Java programmer, stop doubting and switch to Scala .

Source: https://habr.com/ru/post/309910/


All Articles