Sunday, February 27, 2022

Scala 3 Introduction

Scala3 is trending and it's a significant upgrade from scala2. In this article, I am going to write a short introduction to what actually does Scala do and how can we start programming with it. I have done some research on the recently released version (called Scala3) and how can we get started with it. 

Preparing Environment

To prepare the development environment for scala, we have to install java, scala, and configure the JAVA_HOME path so that scala knows where the java is installed. The use of sdkman makes the task of managing the SDKs easier, I prefer to install it. 

1) Install SDKMan

The installation of sdkman is simple. Go to this URL and follow the instructions


Commands:
Installation
$ curl -s "https://get.sdkman.io" | bash
Load Environment
source "$HOME/.sdkman/bin/sdkman-init.sh"
Test it 
$ sdk version

2) Install JDK
$ sdk install java

3) Install Scala

$ sdk install scala

4) Install SBT

$ sdk install sbt

You can verify the installation from the command line. 


Create a sample Scala3 project:
sbt new scala/scala3.g8
This will create a sample Scala3 project. We can take this to start a project.