Friday, May 20, 2016

Start With Scala

What is Scala ?

Scala is a programming language for general software applications. The design of Scala started in 2001, and the first public release was in 2004.

The name Scala is a combination of the words “Scalable” and “Language,” which was chosen to indicate its design goal of growing with the demands of the user base.
Many of the design decisions of Scala are inspired by perceived shortcomings of the Java language with Scala source code compiling to Java Byte Code, allowing it to run on a Java virtual machine.
One of the biggest attractions of Scala is that it has full support for functional programming and has a very strong static type system.
This allows for very concise code, requiring fewer lines of code to achieve the same functionality than many other languages, including Java.
Scala runs on the JVM
Scala gets compiled into Java Byte Code (Java) and is executed by the Java Virtual Machine (JVM). Scala and Java share a common runtime, allowing you to freely mix Java and Scala code if you so desire.
Scala executes Java Code
Scala gets compiled into Byte Code, Scala can call Java code from a Scala program. Hence, you can thus use all the classes of the Java SDK in Scala, as well as your customized Java classes, or any Java open source projects. Scala has a compiler, interpreter and runtime.
Scala has both a compiler and an interpreter which can execute Scala code
Scala code is compiled into Byte Code by the Scala compiler, which can then be executed by the scala command. The scala has similarity with the Java command, in that it executes your compiled Scala code.
Scala code can be directly executed by the Scala interpreter, without you needing to compile it. The Scala interpreter may come in handy as a Scala script interpreter. It is somewhat like a shell script interpreter on a Unix platform.
Scala runs on the JVM. Java and Scala classes, whether they reside in different projects or in the same one, can be freely intermixed and even execute each other’s code.

Getting Started

There are a number of ways to use Scala. Perhaps the easiest is with an IDE (Integrated Development Environment).

This tutorial will use the IntelliJ IDE, which is an IDE that supports a number of languages, including Scala, and has a great free edition, plus a great interactive environment that is perfect for developers new to the language and those with more experience.
In addition, IntelliJ IDE has Scala Worksheet feature support. Worksheets are a REPL (Read-Evaluate-Print Loop) feature that gives you the best of both worlds: compiled code and interactive testing.
Effectively, you get an interactive interpreter for a statically typed language.
You get to enjoy a best-of-class editor support with code completion, hyperlinking, auto-format, etc. A Scala worksheet in IntelliJ IDEA is a Scala file with an .sc extension, which you can run and get evaluation results in a special view appeared in the editor.


No comments:

Post a Comment

Write a comment . .