Published on Feb 22,2017
2.5K Views
Email Post

The emphasis in functional style of programming is laid on functions and evaluation results instead of the order of the occurrence of operations. It is the dominant paradigm of languages, which contrasts with the imperative style of programming. Scala is a functional programming language as it supports functional programming. Though Scala is known to be a fusion of both object-oriented programming and functional programming, here we are going to talk about its functional programming part. Following are some of its functional programming features:

  • A functional language, Scala does not allow any mutable state as it creates a problem of synchronization on its shared access.
  • Scala supports this model with its Actors library, but allows for both mutable as well as immutable variables.
  • Actors library is one way; but otherwise Scala provides you the constructs in such a way that you should typically create vals, not vars. It suggests that Scala ideally works in terms of constants rather than in terms of variables. Unless you really require them, you should not create vars in Scala. It is a native feature of functional programming style, rather than, object oriented programming style.
  • Functions are the “first-class” citizens in Functional Programming. They are treated just like variables.
  • A function can be:
    • assigned to variables.
    • passed to variables.
    • passed to another function.
    • written within a function.
    • Everything in Scala is an object, even the functions included.
    • Similar to Python and Ruby, closures are offered in Scala also.

Frameworks in Scala

Scala is not a language, which you really learn for Spark only. There are several other frameworks that are being developed in Scala. Some of them are:

Spark – In-memory Processing

Apache Spark is a general-purpose cluster in-memory computing system. It is used for data analytics and it abstracts APIs in Java, Scala and Python, and provides an optimized engine that supports general execution graphs.

Play – For Web Development

It’s a high-productivity Java and Scala web application framework that integrates the components and APIs you need for modern web application development.

Scalding – For Map/Reduce

Scalding is a Scala library that makes it easy to specify Hadoop MapReduce jobs. Scalding is built on top of Cascading, a Java library that abstracts away low-level Hadoop details.

Akka – Actors Based Framework

Akka is a toolkit and runtime for building highly concurrent, distributed, and fault tolerant applications on the JVM. Akka is written in Scala.

Got a question for us? Mention them in the comments section and we will get back to you.

Related Posts

Introduction to Scala REPL

What is Scala?

Apache Spark Lighting up the Big Data World

Start today with Apache Spark and Scala!

About Author
edureka
Published on Feb 22,2017

Share on

Browse Categories

Comments
1 Comment