SlideShare a Scribd company logo
Introduction to
Functional
Programming &
Scala
Pros and Cons
- Vikram
Kadi
What is Functional
Programming
Including but not limited to using
 Functions as first class objects
 Passing around functions just as we do do data
in the code
 Constructing higher order functions that can be
composed from basic functions
 Immutability
 Functions do not modify the arguments, instead
they return newer state of arguments
 Recursion
 Instead of loops, computations are viewed as
operating on a sequence of inputs
 Pattern Matching
 Switch style pattern matching
 Lambda functions
 Anonymous functions that are created on the
fly
 Introduced in Java 8
 DSL
 Ability to construct Domain specific languages
Pros
 Multi-core processors
 Increasing cores instead of clock rates
 Side effect free code can be run on multiple
cores in parallel
 Due to immutability, code written with a
functional paradigm tends to align itself in
small methods, this lends itself well to modular
design
 Concise modular code is much easier to test
and mock
Cons
 Learning curve might be steep at times
 Does not completely eliminate mutable
state, but does a good job of isolating it
Scala
 Introduced in 2003, aimed at overcoming various
issues of Java language
 Syntax feels like a mix of Java + Python + Erlang
 Pure OOP
 No primitive types
 Operators are method calls on objects
 Functions are also objects
 Greatly reduces the verbosity of code
 JVM based, interoperable with existing java
code/libraries
Akka
 Actor based concurrency model
 Actors are concurrent running processes
 Do not share any shared state
 Communicate with each other via message
passing
 Library built for both Scala and Java APIs
 Supervision trees and monitoring of actors
built in to the framework, with configurable
restarts and error handling
Getting Started
 Install brew, if you haven’t already
 brew install scala && brew install sbt
 sbt (simple build tool) is based on apache ivy, but
works with maven to pull in dependent java/scala
libraries
 Use scala REPL to try out small language features
without having to worry about creating source
directories and setting up projects
 Read Scala for the impatient, this book has good
reviews
Discuss

More Related Content

What's hot (20)

ODP
Introduction to Scala
Synesso
 
PPT
Spring.Net, Feb 2008, PostSharp: A Technical Introduction
gfraiteur
 
PPTX
Scala: An experience report
Mark Needham
 
PPTX
Scala-Ls1
Aniket Joshi
 
PDF
Build a Chatbot in Ten Minutes - Dave Kerr - Serverless Summit
CodeOps Technologies LLP
 
PDF
Java and effective programming. Is it possible? - IAESTE Case Week 2016
Łukasz Koniecki
 
PDF
Serverless Architecture Patterns - Manoj Ganapathi - Serverless Summit
CodeOps Technologies LLP
 
PDF
Effective programming in Java - Kronospan Job Fair 2016
Łukasz Koniecki
 
PDF
RubyConf Taiwan 2016 - Large scale Rails applications
Florian Dutey
 
PPTX
Introduction To AOP
Donald Belcham
 
PDF
You Used To Inject Me In Your Constructor
Veronica Lillie
 
PDF
RubyConf China 2015 - Rails off assets pipeline
Florian Dutey
 
PDF
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PPTX
Scala Introduction - Meetup Scaladores RJ
Rodrigo Lima
 
PPTX
Spring fundamentals
Santosh Gokak
 
PPTX
Building Your Own DSL with Xtext
GlobalLogic Ukraine
 
PDF
Introduction To Core Java - SpringPeople
SpringPeople
 
PPTX
Introduction to actor model with examples on Akka.NET
Arthur Shvetsov
 
PPTX
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Yan Cui
 
Introduction to Scala
Synesso
 
Spring.Net, Feb 2008, PostSharp: A Technical Introduction
gfraiteur
 
Scala: An experience report
Mark Needham
 
Scala-Ls1
Aniket Joshi
 
Build a Chatbot in Ten Minutes - Dave Kerr - Serverless Summit
CodeOps Technologies LLP
 
Java and effective programming. Is it possible? - IAESTE Case Week 2016
Łukasz Koniecki
 
Serverless Architecture Patterns - Manoj Ganapathi - Serverless Summit
CodeOps Technologies LLP
 
Effective programming in Java - Kronospan Job Fair 2016
Łukasz Koniecki
 
RubyConf Taiwan 2016 - Large scale Rails applications
Florian Dutey
 
Introduction To AOP
Donald Belcham
 
You Used To Inject Me In Your Constructor
Veronica Lillie
 
RubyConf China 2015 - Rails off assets pipeline
Florian Dutey
 
Javantura v4 - FreeMarker in Spring web - Marin Kalapać
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Scala Introduction - Meetup Scaladores RJ
Rodrigo Lima
 
Spring fundamentals
Santosh Gokak
 
Building Your Own DSL with Xtext
GlobalLogic Ukraine
 
Introduction To Core Java - SpringPeople
SpringPeople
 
Introduction to actor model with examples on Akka.NET
Arthur Shvetsov
 
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Yan Cui
 

Viewers also liked (6)

PDF
Josephj Yui Nctu 2
Joseph Chiang
 
PDF
Object Oriented Programming vs Functional Programming - Valencia.rb
Daniel Pecos Martínez
 
PDF
ACCU 2011 Introduction to Scala: An Object Functional Programming Language
Peter Pilgrim
 
KEY
Scala
guest8996422d
 
PPTX
JavaScript Promises
L&T Technology Services Limited
 
PPTX
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
Peter Pilgrim
 
Josephj Yui Nctu 2
Joseph Chiang
 
Object Oriented Programming vs Functional Programming - Valencia.rb
Daniel Pecos Martínez
 
ACCU 2011 Introduction to Scala: An Object Functional Programming Language
Peter Pilgrim
 
JavaScript Promises
L&T Technology Services Limited
 
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
Peter Pilgrim
 
Ad

Similar to Fp and scala (20)

PDF
Develop realtime web with Scala and Xitrum
Ngoc Dao
 
PDF
Reactive Software Systems
Behrad Zari
 
PDF
Get Programming with Scala MEAP V05 Daniela Sfregola
biruktresehb
 
PDF
Lecture1
Muhammad Fayyaz
 
PDF
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
Manuel Bernhardt
 
KEY
Scala: functional programming for the imperative mind
Sander Mak (@Sander_Mak)
 
KEY
The Joy Of Functional Programming
jasondew
 
PDF
Functional programming in Scala
datamantra
 
PDF
Scala a case4
lee.gilbert
 
PDF
Learning Concurrent Programming in Scala Second Edition Aleksandar Prokopec
trtekatsuro
 
PPTX
Functional Programming and Concurrency Patterns in Scala
kellogh
 
ODP
A Tour Of Scala
fanf42
 
PPTX
Scala, Play 2.0 & Cloud Foundry
Pray Desai
 
PPTX
Scala meetup Kyiv slides 20171215
Evaldas Miliauskas
 
PPT
Scala
Andreas Enbohm
 
PDF
Unit 1 notes.pdf
Revathiparamanathan
 
PDF
Quick introduction to scala
Mohammad Hossein Rimaz
 
PPTX
Quick Scala
Puneet Kumar
 
PDF
Yes scala can!
amirmoulavi
 
PPTX
An Intro to Scala for PHP Developers
HuffPost Code
 
Develop realtime web with Scala and Xitrum
Ngoc Dao
 
Reactive Software Systems
Behrad Zari
 
Get Programming with Scala MEAP V05 Daniela Sfregola
biruktresehb
 
Lecture1
Muhammad Fayyaz
 
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
Manuel Bernhardt
 
Scala: functional programming for the imperative mind
Sander Mak (@Sander_Mak)
 
The Joy Of Functional Programming
jasondew
 
Functional programming in Scala
datamantra
 
Scala a case4
lee.gilbert
 
Learning Concurrent Programming in Scala Second Edition Aleksandar Prokopec
trtekatsuro
 
Functional Programming and Concurrency Patterns in Scala
kellogh
 
A Tour Of Scala
fanf42
 
Scala, Play 2.0 & Cloud Foundry
Pray Desai
 
Scala meetup Kyiv slides 20171215
Evaldas Miliauskas
 
Unit 1 notes.pdf
Revathiparamanathan
 
Quick introduction to scala
Mohammad Hossein Rimaz
 
Quick Scala
Puneet Kumar
 
Yes scala can!
amirmoulavi
 
An Intro to Scala for PHP Developers
HuffPost Code
 
Ad

Recently uploaded (20)

PPTX
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 

Fp and scala

  • 2. What is Functional Programming Including but not limited to using  Functions as first class objects  Passing around functions just as we do do data in the code  Constructing higher order functions that can be composed from basic functions  Immutability  Functions do not modify the arguments, instead they return newer state of arguments
  • 3.  Recursion  Instead of loops, computations are viewed as operating on a sequence of inputs  Pattern Matching  Switch style pattern matching  Lambda functions  Anonymous functions that are created on the fly  Introduced in Java 8  DSL  Ability to construct Domain specific languages
  • 4. Pros  Multi-core processors  Increasing cores instead of clock rates  Side effect free code can be run on multiple cores in parallel  Due to immutability, code written with a functional paradigm tends to align itself in small methods, this lends itself well to modular design  Concise modular code is much easier to test and mock
  • 5. Cons  Learning curve might be steep at times  Does not completely eliminate mutable state, but does a good job of isolating it
  • 6. Scala  Introduced in 2003, aimed at overcoming various issues of Java language  Syntax feels like a mix of Java + Python + Erlang  Pure OOP  No primitive types  Operators are method calls on objects  Functions are also objects  Greatly reduces the verbosity of code  JVM based, interoperable with existing java code/libraries
  • 7. Akka  Actor based concurrency model  Actors are concurrent running processes  Do not share any shared state  Communicate with each other via message passing  Library built for both Scala and Java APIs  Supervision trees and monitoring of actors built in to the framework, with configurable restarts and error handling
  • 8. Getting Started  Install brew, if you haven’t already  brew install scala && brew install sbt  sbt (simple build tool) is based on apache ivy, but works with maven to pull in dependent java/scala libraries  Use scala REPL to try out small language features without having to worry about creating source directories and setting up projects  Read Scala for the impatient, this book has good reviews