What are some good beginner projects for Scala to learn the language?

I am thinking of trying to learn this language through a project, but I am not sure what Scala is best at doing. For example, C is good for low-level projects, Python is good for AI-related projects and Go is good for network projects. Is there certain area that Scala thrives in?

I typically make a simple UI and a simple http client to learn a new language by doing one of the tasks in a language I already know and a new language I want to learn. I have looked into Laminar to make a web application or ScalaFX to make a gui, but I am not sure what the best beginner friendly library is for this language.

What are some good projects you would recommend making to a beginner in the language?

Well, it depends a bit on the ecosystem you are. But, in general, most Scala devs work on highly concurrent backend systems. So, a simple HTTP app is a good starting point.
We have a bunch of libraries for that, each more tailored to specific ecosystems: cask, http4s, smithy4s, zio-http, pekko-http, etc.

For the UI part, I have had good experiences with Laminar but I rarely work on the front-end. I do know there are also another bunch of alternatives.

2 Likes

Thank you for the help. Is there any good library you could recommend for either sending queries to an SQL database or a MongoDB database?

This is a bit old but might give an overview:

2 Likes

Also why is Scala best used for concurrent backend systems? What does the language handle differently with concurrency that other languages do not? Again thank you for the help

Thanks for the article. It was a good read.

First of all, note that what follows is a mix of personal opinions based on real-life experience. Thus, will I am trying to be objective, this is far from being universally true for everyone.
Second, note that the answer is actually split into two parts / levels: The base language, and the ecosystems and paradigms it allows.

At the first level, the base language provides a lot of tools that makes writing maintainable programs easier:

  • Strong type system
  • Rich stdlib
  • Allows using ADTs to model data
  • Immutability by default makes code safer with respect to concurrency

At the second level, we have two main paradigms that focus on concurrency.

  1. Programs as Values, provided by either the typelevel ecosystem or the ZIO ecosystem.
  2. Actor systems, provided by the Akka / Pekko ecosystem.

If you are interested about why I think “Programs as Values” excels at concurrency, please check: GitHub - BalmungSan/programs-as-values: Source code of the programs as values presentation

1 Like

Thank you for the resources. Just to clarify, Programs as Values is defined as turning functions into classes and executing those classes at the end of main, right? Is there no Mutex or possibility of a deadlock if you can order the execution of those objects?

Mostly yes, a better wording would be:

Turning computation into values that are composed and then explicitly ran at the end of main.

Yes and yes.
As the talk says, “Programs as Values” makes concurrency easier not easy.

Fun fact: cats-effect has a Mutex: Mutex · Cats Effect and I am the author of the current implementation :stuck_out_tongue:

1 Like