Scala (programming language)
Scala (programming language)
Scala stands for Scalable Language. It is a multi-paradigm programming language. Scala language includes features of functional programming and object-oriented programming. It is a statically typed language. Its source code is compiled into bytecode and executed by Java virtual machine(JVM).
Scala is object-oriented
Scala is an object-oriented language. In Scala, every value is an object.
Scala execution
Scala uses Java Virtual Machine (JVM) to execute bytecode. Its code is compiled into bytecode and executed by Java Virtual Machine. So you need only JVM to start development with it. Scala can also use all java classes and allows us to create our custom class.
Why use Scala?
It is designed to grow with the demands of its user, from writing small scripts to building a massive system for data processing.
Scala is used in Data processing, distributed computing, and web development. It powers the data engineering infrastructure of many companies.
Who uses Scala?
Scala language is mostly used by Software engineers and Data Engineers. You’ll see some data scientists using it with Apache Spark to process huge data.
How Scala is different from Java?
- Nested functions – It allows us to define a function inside another function.
- Closures – A function whose return value depends on variables declared outside it of function.
- Every value is an object.
- Every operation is a method call.
For example:
1 2 | val sumX = 1 .+( 3 ) val sumY = 1 + 3 |
Output of both is the same.
Popular frameworks of Scala
Let’s understand how we can set up a development environment for Scala. As we know, Scala uses JVM. So in order to execute a Scala program, you need to have java installed on your machine.
sudo apt-get update
Now type: sudo apt-get install openjdk-8-jdk
Scala Basics
Scala is very similar to Java Language, and both use Java Virtual Machine(JVM) to execute code. So, learning Scala would be super easy for you if you have a solid understanding of the Java language. But it’s not mandatory to know Java before learning the Scala Language.
Let’s write our first Scala program!
1 2 3 4 5 | object HelloWorld { def main(args : Array[String]) { println( "Hello world!" ) } } |
Comments
Post a Comment