SlideShare a Scribd company logo
Scala Programming Introduction
March 10, 2016
Agenda
 Functional Programming Vs Imperative Programming
 Why Functional Programming?
 Scala Programming Fundamentals
 REPL
 Scala Runnable Program
 Scala classes and objects
 Tuples
 Scala Collections Vs Java Collections
 Apache Spark Scala API Intro
Imperative Versus Functional Programming
In imperative approach, a developer writes code that describes in exacting detail the
steps that the computer must take to accomplish the goal.
Functional approach involves composing the problem as a set of functions to be
executed. “Pure Functions” makes the order of execution irrelevant - since no side-
effect can change the value of an expression, it can be evaluated at any time.
Characteristic Imperative approach Functional approach
Programmer focus
How to perform tasks (algorithms) and how
to track changes in state.
What information is desired and what
transformations are required.
State changes Important. Non-existent.
Order of execution Important. Low importance.
Primary flow control
Loops, conditionals, and function (method)
calls.
Function calls, including recursion.
Primary manipulation unit Instances of structures or classes. Functions as first-class objects and data collections.
Why Functional Programming?
 Describe what you want, rather than how to get it.
 Instead of creating a for-loop with an iterator variable and marching through an collection
doing something to each cell, pass a function and it will be executed for all the elements in
the collection which can be optimized
 More concise and expressive code
 Functional programming moves more basic programming ideas into the compiler.
 Syntactic Sugar – case classes, pattern matching
 Type Inference
 List comprehension
 conversion to primitives, tail recursion
 Implicit conversions
 Concurrency
 No Shared mutable state – so no locking required
 Pure functional languages support lazy evaluation.
 Can create infinitely large collections
 Value will be calculated only when required and function call be substituted in place of
functional value (Referential integrity)
Scala Programming Fundamentals
 Scala brings together concepts from both Functional Programming and
Objected Oriented Programming.
 Provides a more comprehensive API, a superior compiler but stills runs
on the JVM.
 Demos:
 REPL
 Runnable Program in Scala
 Scala classes and Objects
 Tuples
Java Collections Hierarchy
Scala Collection Hierarchy
Scala Immutable Collections
Scala Mutable Collections
Why Spark Uses Scala?
Apache Spark Execution Model
Transformations + lazy evaluation = Optimization
Ad

Recommended

Fp and scala
Fp and scala
vikram kadi
 
Introduction to Scala for Java Developers
Introduction to Scala for Java Developers
Solix JJ
 
You Used To Inject Me In Your Constructor
You Used To Inject Me In Your Constructor
Veronica Lillie
 
Functional Programming in Java
Functional Programming in Java
Premanand Chandrasekaran
 
Scala-Ls1
Scala-Ls1
Aniket Joshi
 
Lambda Behave - Java 8's Testing Framework
Lambda Behave - Java 8's Testing Framework
sara stanford
 
Introduction to Scala language
Introduction to Scala language
Aaqib Pervaiz
 
Scala Presentation Work
Scala Presentation Work
Skills Matter
 
New in Spring Framework 5.0: Functional Web Framework
New in Spring Framework 5.0: Functional Web Framework
VMware Tanzu
 
GraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basics
Visuality
 
Scala in Action - Heiko Seeburger
Scala in Action - Heiko Seeburger
JAX London
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoR
Sumanth krishna
 
Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)
Brooklyn Zelenka
 
Implementing GraphQL API in Elixir – Victor Deryagin
Implementing GraphQL API in Elixir – Victor Deryagin
Elixir Club
 
Spark UDFs are EviL, Catalyst to the rEsCue!
Spark UDFs are EviL, Catalyst to the rEsCue!
Adi Polak
 
The Apollo and GraphQL Stack
The Apollo and GraphQL Stack
Sashko Stubailo
 
Zen and the Art of REST API documentation - MuCon London 2015
Zen and the Art of REST API documentation - MuCon London 2015
Steve Judd
 
Why should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming Paradigm
Tech Triveni
 
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
Srimanta Sahu
 
James Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL app
React Conf Brasil
 
JAVA 8 Parallel Stream
JAVA 8 Parallel Stream
Tengwen Wang
 
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Lessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its Ecosystem
Petr Hošek
 
Automatic Forecasting using Prophet, Databricks, Delta Lake and MLflow
Automatic Forecasting using Prophet, Databricks, Delta Lake and MLflow
Databricks
 
Linq in asp.net
Linq in asp.net
baabtra.com - No. 1 supplier of quality freshers
 
Java 8 parallel stream
Java 8 parallel stream
Yung Chieh Tsai
 
Raphael Amorim - Scrating React Fiber
Raphael Amorim - Scrating React Fiber
React Conf Brasil
 
New features of rails 5
New features of rails 5
Fumiya Shinozuka
 
Parquet and AVRO
Parquet and AVRO
airisData
 
Predict Repeat Shoppers with H20 and Spark
Predict Repeat Shoppers with H20 and Spark
airisData
 

More Related Content

What's hot (20)

New in Spring Framework 5.0: Functional Web Framework
New in Spring Framework 5.0: Functional Web Framework
VMware Tanzu
 
GraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basics
Visuality
 
Scala in Action - Heiko Seeburger
Scala in Action - Heiko Seeburger
JAX London
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoR
Sumanth krishna
 
Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)
Brooklyn Zelenka
 
Implementing GraphQL API in Elixir – Victor Deryagin
Implementing GraphQL API in Elixir – Victor Deryagin
Elixir Club
 
Spark UDFs are EviL, Catalyst to the rEsCue!
Spark UDFs are EviL, Catalyst to the rEsCue!
Adi Polak
 
The Apollo and GraphQL Stack
The Apollo and GraphQL Stack
Sashko Stubailo
 
Zen and the Art of REST API documentation - MuCon London 2015
Zen and the Art of REST API documentation - MuCon London 2015
Steve Judd
 
Why should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming Paradigm
Tech Triveni
 
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
Srimanta Sahu
 
James Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL app
React Conf Brasil
 
JAVA 8 Parallel Stream
JAVA 8 Parallel Stream
Tengwen Wang
 
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Lessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its Ecosystem
Petr Hošek
 
Automatic Forecasting using Prophet, Databricks, Delta Lake and MLflow
Automatic Forecasting using Prophet, Databricks, Delta Lake and MLflow
Databricks
 
Linq in asp.net
Linq in asp.net
baabtra.com - No. 1 supplier of quality freshers
 
Java 8 parallel stream
Java 8 parallel stream
Yung Chieh Tsai
 
Raphael Amorim - Scrating React Fiber
Raphael Amorim - Scrating React Fiber
React Conf Brasil
 
New features of rails 5
New features of rails 5
Fumiya Shinozuka
 
New in Spring Framework 5.0: Functional Web Framework
New in Spring Framework 5.0: Functional Web Framework
VMware Tanzu
 
GraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basics
Visuality
 
Scala in Action - Heiko Seeburger
Scala in Action - Heiko Seeburger
JAX London
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoR
Sumanth krishna
 
Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)
Brooklyn Zelenka
 
Implementing GraphQL API in Elixir – Victor Deryagin
Implementing GraphQL API in Elixir – Victor Deryagin
Elixir Club
 
Spark UDFs are EviL, Catalyst to the rEsCue!
Spark UDFs are EviL, Catalyst to the rEsCue!
Adi Polak
 
The Apollo and GraphQL Stack
The Apollo and GraphQL Stack
Sashko Stubailo
 
Zen and the Art of REST API documentation - MuCon London 2015
Zen and the Art of REST API documentation - MuCon London 2015
Steve Judd
 
Why should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming Paradigm
Tech Triveni
 
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
Srimanta Sahu
 
James Baxley - Statically typing your GraphQL app
James Baxley - Statically typing your GraphQL app
React Conf Brasil
 
JAVA 8 Parallel Stream
JAVA 8 Parallel Stream
Tengwen Wang
 
Lessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its Ecosystem
Petr Hošek
 
Automatic Forecasting using Prophet, Databricks, Delta Lake and MLflow
Automatic Forecasting using Prophet, Databricks, Delta Lake and MLflow
Databricks
 
Raphael Amorim - Scrating React Fiber
Raphael Amorim - Scrating React Fiber
React Conf Brasil
 

Viewers also liked (17)

Parquet and AVRO
Parquet and AVRO
airisData
 
Predict Repeat Shoppers with H20 and Spark
Predict Repeat Shoppers with H20 and Spark
airisData
 
Getting Spark ready for real-time, operational analytics
Getting Spark ready for real-time, operational analytics
airisData
 
Apache mahout
Apache mahout
Puneet Gupta
 
Mahout scala and spark bindings
Mahout scala and spark bindings
Dmitriy Lyubimov
 
Distributed Machine Learning with Apache Mahout
Distributed Machine Learning with Apache Mahout
Suneel Marthi
 
Mahout
Mahout
Anastasiia Kornilova
 
Whats Right and Wrong with Apache Mahout
Whats Right and Wrong with Apache Mahout
Ted Dunning
 
Apache Spark Overview
Apache Spark Overview
airisData
 
Why Scala Is Taking Over the Big Data World
Why Scala Is Taking Over the Big Data World
Dean Wampler
 
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Flink Forward
 
Escaping Flatland: Interactive High-Dimensional Data Analysis in Drug Discove...
Escaping Flatland: Interactive High-Dimensional Data Analysis in Drug Discove...
Spark Summit
 
Apache Spark & Scala
Apache Spark & Scala
Edureka!
 
Why Scala?
Why Scala?
Alex Payne
 
A Brief Intro to Scala
A Brief Intro to Scala
Tim Underwood
 
A Quick Tutorial on Mahout’s Recommendation Engine (v 0.4)
A Quick Tutorial on Mahout’s Recommendation Engine (v 0.4)
Jee Vang, Ph.D.
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
pramode_ce
 
Parquet and AVRO
Parquet and AVRO
airisData
 
Predict Repeat Shoppers with H20 and Spark
Predict Repeat Shoppers with H20 and Spark
airisData
 
Getting Spark ready for real-time, operational analytics
Getting Spark ready for real-time, operational analytics
airisData
 
Mahout scala and spark bindings
Mahout scala and spark bindings
Dmitriy Lyubimov
 
Distributed Machine Learning with Apache Mahout
Distributed Machine Learning with Apache Mahout
Suneel Marthi
 
Whats Right and Wrong with Apache Mahout
Whats Right and Wrong with Apache Mahout
Ted Dunning
 
Apache Spark Overview
Apache Spark Overview
airisData
 
Why Scala Is Taking Over the Big Data World
Why Scala Is Taking Over the Big Data World
Dean Wampler
 
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Flink Forward
 
Escaping Flatland: Interactive High-Dimensional Data Analysis in Drug Discove...
Escaping Flatland: Interactive High-Dimensional Data Analysis in Drug Discove...
Spark Summit
 
Apache Spark & Scala
Apache Spark & Scala
Edureka!
 
A Brief Intro to Scala
A Brief Intro to Scala
Tim Underwood
 
A Quick Tutorial on Mahout’s Recommendation Engine (v 0.4)
A Quick Tutorial on Mahout’s Recommendation Engine (v 0.4)
Jee Vang, Ph.D.
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
pramode_ce
 
Ad

Similar to Scala Programming Introduction (20)

Functional programming in Scala
Functional programming in Scala
datamantra
 
Functional programming in scala coursera
Functional programming in scala coursera
Ketan Raval
 
Get Programming with Scala MEAP V05 Daniela Sfregola
Get Programming with Scala MEAP V05 Daniela Sfregola
biruktresehb
 
Functional Programming in Scala in a Nutshell
Functional Programming in Scala in a Nutshell
xxx nell
 
ScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin Odersky
Typesafe
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Sander Mak (@Sander_Mak)
 
Functional programming
Functional programming
ijcd
 
Functional Programming In Scala Second Edition Meap V08 2nd All Chapters Avai...
Functional Programming In Scala Second Edition Meap V08 2nd All Chapters Avai...
cawulineriku
 
Ankara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with Scala
Ensar Basri Kahveci
 
The joy of functional programming
The joy of functional programming
Steve Zhang
 
Functional Programming in Scala 1st Edition Paul Chiusano
Functional Programming in Scala 1st Edition Paul Chiusano
sturledemsar
 
Introduction to functional programming
Introduction to functional programming
Konrad Szydlo
 
Teach Yourself some Functional Programming with Scala
Teach Yourself some Functional Programming with Scala
Damian Jureczko
 
Functional Programming #FTW
Functional Programming #FTW
Adriano Bonat
 
Functional Programming in Scala in a Nutshell: Review of Functional Programmi...
Functional Programming in Scala in a Nutshell: Review of Functional Programmi...
Namuk Park
 
Introduction to Functional Programming
Introduction to Functional Programming
Dave Fancher
 
Functional programming is the most extreme programming
Functional programming is the most extreme programming
samthemonad
 
Functional programming in Python 1st Edition David Mertz
Functional programming in Python 1st Edition David Mertz
nkossivilana87
 
Why functional programming in C# & F#
Why functional programming in C# & F#
Riccardo Terrell
 
Thinking Functionally
Thinking Functionally
Piyush Katariya
 
Functional programming in Scala
Functional programming in Scala
datamantra
 
Functional programming in scala coursera
Functional programming in scala coursera
Ketan Raval
 
Get Programming with Scala MEAP V05 Daniela Sfregola
Get Programming with Scala MEAP V05 Daniela Sfregola
biruktresehb
 
Functional Programming in Scala in a Nutshell
Functional Programming in Scala in a Nutshell
xxx nell
 
ScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin Odersky
Typesafe
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
Sander Mak (@Sander_Mak)
 
Functional programming
Functional programming
ijcd
 
Functional Programming In Scala Second Edition Meap V08 2nd All Chapters Avai...
Functional Programming In Scala Second Edition Meap V08 2nd All Chapters Avai...
cawulineriku
 
Ankara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with Scala
Ensar Basri Kahveci
 
The joy of functional programming
The joy of functional programming
Steve Zhang
 
Functional Programming in Scala 1st Edition Paul Chiusano
Functional Programming in Scala 1st Edition Paul Chiusano
sturledemsar
 
Introduction to functional programming
Introduction to functional programming
Konrad Szydlo
 
Teach Yourself some Functional Programming with Scala
Teach Yourself some Functional Programming with Scala
Damian Jureczko
 
Functional Programming #FTW
Functional Programming #FTW
Adriano Bonat
 
Functional Programming in Scala in a Nutshell: Review of Functional Programmi...
Functional Programming in Scala in a Nutshell: Review of Functional Programmi...
Namuk Park
 
Introduction to Functional Programming
Introduction to Functional Programming
Dave Fancher
 
Functional programming is the most extreme programming
Functional programming is the most extreme programming
samthemonad
 
Functional programming in Python 1st Edition David Mertz
Functional programming in Python 1st Edition David Mertz
nkossivilana87
 
Why functional programming in C# & F#
Why functional programming in C# & F#
Riccardo Terrell
 
Ad

Recently uploaded (20)

Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Mark Billinghurst
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
nnnnnnnnnnnn7777777777777777777777777777777.pptx
nnnnnnnnnnnn7777777777777777777777777777777.pptx
gayathri venkataramani
 
Machine Learning - Classification Algorithms
Machine Learning - Classification Algorithms
resming1
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Structural Wonderers_new and ancient.pptx
Structural Wonderers_new and ancient.pptx
nikopapa113
 
International Journal of Advanced Information Technology (IJAIT)
International Journal of Advanced Information Technology (IJAIT)
ijait
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Introduction to Python Programming Language
Introduction to Python Programming Language
merlinjohnsy
 
(Continuous Integration and Continuous Deployment/Delivery) is a fundamental ...
(Continuous Integration and Continuous Deployment/Delivery) is a fundamental ...
ketan09101
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Mark Billinghurst
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
nnnnnnnnnnnn7777777777777777777777777777777.pptx
nnnnnnnnnnnn7777777777777777777777777777777.pptx
gayathri venkataramani
 
Machine Learning - Classification Algorithms
Machine Learning - Classification Algorithms
resming1
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Structural Wonderers_new and ancient.pptx
Structural Wonderers_new and ancient.pptx
nikopapa113
 
International Journal of Advanced Information Technology (IJAIT)
International Journal of Advanced Information Technology (IJAIT)
ijait
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Introduction to Python Programming Language
Introduction to Python Programming Language
merlinjohnsy
 
(Continuous Integration and Continuous Deployment/Delivery) is a fundamental ...
(Continuous Integration and Continuous Deployment/Delivery) is a fundamental ...
ketan09101
 

Scala Programming Introduction

  • 2. Agenda  Functional Programming Vs Imperative Programming  Why Functional Programming?  Scala Programming Fundamentals  REPL  Scala Runnable Program  Scala classes and objects  Tuples  Scala Collections Vs Java Collections  Apache Spark Scala API Intro
  • 3. Imperative Versus Functional Programming In imperative approach, a developer writes code that describes in exacting detail the steps that the computer must take to accomplish the goal. Functional approach involves composing the problem as a set of functions to be executed. “Pure Functions” makes the order of execution irrelevant - since no side- effect can change the value of an expression, it can be evaluated at any time. Characteristic Imperative approach Functional approach Programmer focus How to perform tasks (algorithms) and how to track changes in state. What information is desired and what transformations are required. State changes Important. Non-existent. Order of execution Important. Low importance. Primary flow control Loops, conditionals, and function (method) calls. Function calls, including recursion. Primary manipulation unit Instances of structures or classes. Functions as first-class objects and data collections.
  • 4. Why Functional Programming?  Describe what you want, rather than how to get it.  Instead of creating a for-loop with an iterator variable and marching through an collection doing something to each cell, pass a function and it will be executed for all the elements in the collection which can be optimized  More concise and expressive code  Functional programming moves more basic programming ideas into the compiler.  Syntactic Sugar – case classes, pattern matching  Type Inference  List comprehension  conversion to primitives, tail recursion  Implicit conversions  Concurrency  No Shared mutable state – so no locking required  Pure functional languages support lazy evaluation.  Can create infinitely large collections  Value will be calculated only when required and function call be substituted in place of functional value (Referential integrity)
  • 5. Scala Programming Fundamentals  Scala brings together concepts from both Functional Programming and Objected Oriented Programming.  Provides a more comprehensive API, a superior compiler but stills runs on the JVM.  Demos:  REPL  Runnable Program in Scala  Scala classes and Objects  Tuples
  • 10. Why Spark Uses Scala?
  • 11. Apache Spark Execution Model Transformations + lazy evaluation = Optimization