Learn what is Scala programming language

by Nadim Bahadoor | Last updated: July 25, 2017 at 13:07 pm

Overview

In this tutorial, we will go over the Scala programming language.

 

If you are new to Scala or coming from other programming backgrounds like Java or .NET, don't be worried about the inner details of Scala yet. I will keep this tutorial very high level as we will have other tutorials to follow on the features of Scala.

 

Steps

1. So what is Scala programming language?
Scala is both a Functional programming and Object Oriented programming language that runs on the JVM! That was not so complicated :)

 

Perhaps the picture below will be a good visual to  keep in mind.

 

Scala programming language

 

2. Who created it?
It was designed by Martin Odersky and the language runs on the Java Virtual Machine (JVM). The language has been around for just about a decade and is actively being developed. At the time of writing, there were 269 contributors on the GitHub Scala repository.

 

Scala programming language GitHub

 

NOTE:

  • GitHub is a popular repository where you can view and contribute to a wide variety of open source projects.
  • GitHub should not be confused with Git version control. As per wikipedia, GitHub is a web-based Git repository hosting service, while Git is a version control similar to SVN, CVS or Perforce.




3. What is the JDK/JVM?
If you are new to programming, you may be asking yourself what is the JDK? In short, the JDK contains a set of libraries and utilities for developing Java applications. It also comes with the Java Runtime Environment, also known as the JRE. In addition, you will also hear the term Java Virtual Machine or JVM used to refer to the JRE.

 

If you are coming from another programming language like say .NET, then you can think of the JDK to be similar to the. NET runtime in that it provides the environment for you to write and run your code.

 

If you have been developing in Java, then I'm sure you can skip this explanation and move on to the next one :)

 

 

4. Why do you need the JDK for writing Scala applications?
If you recall from Step 1, Scala is both a Functional programming and Object Oriented programming language that runs on the JVM!

 

As a result, it interoperates nicely with existing Java code and libraries. Perhaps the diagram below provides a better answer to this question:

Scala and Java programming language


NOTE:

  • In Step 1 of the diagram, as a developer, you will write your Scala code. However, say for example that the company you work for already has existing Java libraries that would perhaps take too much effort and resources to refactor in Scala. In addition, you may be using other third party Java libraries that you obviously cannot change or may be using open source Java libraries. Fortunately, moving to Scala and taking advantage of its functional features does not mean that you need to start from scratch. It works with your existing Java code stack!
  • In Step 2 of the diagram, you will call the Java compiler namely javac to compile your Java code. With regards to compiling your Scala code, you would use the Scala compiler namely scalac. In most cases, you will be using an Integrated Development Environment or IDE to help you easily write and compile your applications. In Chapter 1, we will in fact go over how to make use of the IntelliJ IDE to write Scala applications.
  • In Step 3 of the diagram,  your compiled classes are converted into byte code which is in essence the language that the JVM understands and where your code will eventually be run from. If you are new to the Java platform or to programming in general, you can read this tutorial from Oracle which provides some additional information about how Java classes are compiled and eventually ran on the JVM.

This concludes our tutorial on Learn what is the Scala programming language and I hope you've found it useful!

 

Stay in touch via Facebook and Twitter for upcoming tutorials!

 

Don't forget to like and share this page :)

Summary

In this article, we went over the following:

  • What is Scala
  • Who created Scala
  • What is the JDK/JVM
  • Why we need the JVM for running Scala applications

Tip

  • This tutorial was inspired by the presentation from Martin Odersky. The talk is a bit long but I highly recommend you watch at least the first 30 minutes of it as Martin Odersky does an awesome job at presenting the Scala language.
     
  • For additional information on Scala, you can refer to the official site.

Source Code

The source code is available on the allaboutscala GitHub repository.

 

What's Next

In the next tutorial, I will go over the core features of Scala as well as showcasing some of the benefits  for adopting Scala.

Nadim Bahadoor on FacebookNadim Bahadoor on GithubNadim Bahadoor on LinkedinNadim Bahadoor on Twitter
Nadim Bahadoor
Senior Software Developer | Elsevier
Founder of allaboutscala.com. I have over 10 years of experience in building large scale real-time trading systems in the financial industry. Passionate about Distributed Systems, Scala, Big Data and Functional Programming. Stay in touch for upcoming tutorials!
Other allaboutscala.com tutorials you may like:

Share this article on