Scala Introduction

    Hey friends, in today’s blog we are going to learn about a programming language that is functional as well as object oriented in nature. Scala Programming language is based on Java, so if you are aware about the Java syntax, then it will be easy to learn Scala. Further if you do not have expertise in Java but if you have knowledge about other programming language like C, C++, C# or Python, then it will also help in grasping Scala concepts since most programming basics hold true for these programming languages leaving the syntax differences that can be learned.

    Now, to understand it, we first need to be clear about the two concepts:

    1. Functional Programming:  A paradigm where programs are composed using functions where a function takes some arguments and returns the same result on the same input variables and there are no other side-effects. Secondly, where a function can be passed as an argument to another function, or a function can be returned as a result.
    2. Object Oriented Programming:  A paradigm where a real-world problem can be implemented in the form of classes and objects following the basic OOPs concepts like: Abstraction, Encapsulation, Inheritance and Polymorphism.

    File extension of Scala source file may be either “.scala” or “.sc”. Scala language lets you create any kind of application like web application, mobile application, desktop based application etc.

    Scala can easily be installed on any UNIX or Windows based system. There is one prerequisite before installing Scala on your machine that you must have Java 1.8 or greater installed on your computer. If java is already installed, you can verify it by running below command on the CMD:

    Java -version

    Once you have java installed on your machine you can follow below steps to proceed:

    1. You can download Scala from its official website:
    2. Set up an environment variable SCALA_HOME to point to “scala” file in the package where the language is installed.

    1. Next, add this SCALA_HOME variable to PATH environment variable.

    1. Now, to check if it has installed successfully. Open a fresh command prompt window and type “scala”. Something like below should appear on the screen.

    Note: To start experimenting with Scala right away, you can use Scastie in your web browser. Scastie is an online “playground” where you can experiment with Scala examples to see how things work, with access to all Scala compilers and published libraries.