SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
The rise of Functional
Programming




  A short presentation by Tjerk Wolterink
Outline
Hands on
1. From Imperative to Functional
2. Java and Lambda
Theory
3. Referential Transparency
4. Higher Order Functions
5. Lazy Evaluation
6. Pattern Matching
From Imperative to
Functional
   Lets dive into code straight away!
Initial Example (dataset)
The Requirement
● For all persons that are older than 20, get
  the sum of those ages
Imperative Solution (Java)
Imperative Programming
●   Thinks in terms of steps todo
●   Time goes forward
●   Mutable state
●   Threads are needed to utilize multiple cores
●   Concurrent Programming and Locking
Functional Solution
Lets make it simpler
Definition of Sum
Reduction
● Based on rewriting
● No state
Functional Programming
● Write what you want, not how to do it
● Everything is a function
● Stateless
  ○ No side effects, reasoning is easier
● Concurrency
  ○ Plays extremely nice with the rising multi-core
    technology
  ○ Execute your program in a distributed network
  ○ Hadoop / Map Reduce
● Academia love it
  ○ Based on λ-Calculus and Rule Rewriting
  ○ Easier to prove programs correct
  ○ No state explosion
Functional Languages
Fully Functional
● Haskell, Lisp (from 1950!), Erlang
● XSLT, Clojure (VM Based)
Powerfull Functional Support
● Python, JavaScript, Scala (VM Based),
  Groovy (VM Based)
Sort of Functional
● C++ function pointers
● C#
● Java Lambda
● Bash shell? ( ls | grep 'test' | more)
Java and Lamba
Finally Oracle got..... Hopefully
Java Lambda JSR-335
"Extend the Java language to support compact
lambda expressions (closures), as well as
related language and library features to enable
the Java SE APIs to use lambda expressions
effectively."
Lambdas and Interfaces
Java 8 Hooray!
Theory
     If Time Allows
- nope time didn't allow-
       Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Functional programming
Functional programmingFunctional programming
Functional programmingijcd
 
Introduction to Functional Programming and Clojure
Introduction to Functional Programming and ClojureIntroduction to Functional Programming and Clojure
Introduction to Functional Programming and ClojureSoumendra Daas
 
Devoxx 2013 Summary/Keynotes
Devoxx 2013 Summary/KeynotesDevoxx 2013 Summary/Keynotes
Devoxx 2013 Summary/KeynotesAliaksandr Kazlou
 
Introduction to Reactjs
Introduction to ReactjsIntroduction to Reactjs
Introduction to ReactjsNodeXperts
 
Modern Programming Languages - An overview
Modern Programming Languages - An overviewModern Programming Languages - An overview
Modern Programming Languages - An overviewAyman Mahfouz
 
Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"
Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"
Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"LogeekNightUkraine
 
Functional programming ideas in python
Functional programming ideas in pythonFunctional programming ideas in python
Functional programming ideas in pythonManish Tomar
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutinesRoman Elizarov
 
Green Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native PerformanceGreen Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native PerformanceGreen Custard
 
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLReactive.IO
 
Gdg dev fest 2107 to kotlin, with love
Gdg dev fest 2107   to kotlin, with loveGdg dev fest 2107   to kotlin, with love
Gdg dev fest 2107 to kotlin, with loveAyman Mahfouz
 
Imperative and-functional-programming
Imperative and-functional-programmingImperative and-functional-programming
Imperative and-functional-programmingrameses francia
 

Was ist angesagt? (19)

Functional programming
Functional programmingFunctional programming
Functional programming
 
Introduction to Functional Programming and Clojure
Introduction to Functional Programming and ClojureIntroduction to Functional Programming and Clojure
Introduction to Functional Programming and Clojure
 
Elixir otp-basics
Elixir otp-basicsElixir otp-basics
Elixir otp-basics
 
Devoxx 2013 Summary/Keynotes
Devoxx 2013 Summary/KeynotesDevoxx 2013 Summary/Keynotes
Devoxx 2013 Summary/Keynotes
 
Introduction to Reactjs
Introduction to ReactjsIntroduction to Reactjs
Introduction to Reactjs
 
Modern Programming Languages - An overview
Modern Programming Languages - An overviewModern Programming Languages - An overview
Modern Programming Languages - An overview
 
Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"
Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"
Oleksii Pedorenko and Dmytro Melnychuk "DAO Project Experience"
 
Lefty
LeftyLefty
Lefty
 
Concurrent programming
Concurrent programmingConcurrent programming
Concurrent programming
 
Functional programming ideas in python
Functional programming ideas in pythonFunctional programming ideas in python
Functional programming ideas in python
 
C#
C#C#
C#
 
C#
C#C#
C#
 
C#
C#C#
C#
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutines
 
Green Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native PerformanceGreen Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native Performance
 
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
 
Gdg dev fest 2107 to kotlin, with love
Gdg dev fest 2107   to kotlin, with loveGdg dev fest 2107   to kotlin, with love
Gdg dev fest 2107 to kotlin, with love
 
Imperative and-functional-programming
Imperative and-functional-programmingImperative and-functional-programming
Imperative and-functional-programming
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 

Ähnlich wie The rise of Functional Programming: From Imperative to Functional

Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software SystemsBehrad Zari
 
Introduction to Clojure
Introduction to ClojureIntroduction to Clojure
Introduction to ClojureRenzo Borgatti
 
Java Closures
Java ClosuresJava Closures
Java ClosuresBen Evans
 
Why Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalkWhy Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalkJakub Holy
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Martijn Verburg
 
Guglielmo iozzia - Google I/O extended dublin 2018
Guglielmo iozzia - Google  I/O extended dublin 2018Guglielmo iozzia - Google  I/O extended dublin 2018
Guglielmo iozzia - Google I/O extended dublin 2018Guglielmo Iozzia
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdprat0ham
 
Java programming language
Java programming languageJava programming language
Java programming languageSubhashKumar329
 
I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?sbjug
 
Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Metosin Oy
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Martijn Verburg
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous ApplicationsJohan Edstrom
 
Are High Level Programming Languages for Multicore and Safety Critical Conver...
Are High Level Programming Languages for Multicore and Safety Critical Conver...Are High Level Programming Languages for Multicore and Safety Critical Conver...
Are High Level Programming Languages for Multicore and Safety Critical Conver...InfinIT - Innovationsnetværket for it
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinayViplav Jain
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)Dierk König
 
Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark Summit
 

Ähnlich wie The rise of Functional Programming: From Imperative to Functional (20)

Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software Systems
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Introduction to Clojure
Introduction to ClojureIntroduction to Clojure
Introduction to Clojure
 
Java Closures
Java ClosuresJava Closures
Java Closures
 
Why Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalkWhy Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalk
 
Scala-Ls1
Scala-Ls1Scala-Ls1
Scala-Ls1
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
 
Guglielmo iozzia - Google I/O extended dublin 2018
Guglielmo iozzia - Google  I/O extended dublin 2018Guglielmo iozzia - Google  I/O extended dublin 2018
Guglielmo iozzia - Google I/O extended dublin 2018
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
 
Java programming language
Java programming languageJava programming language
Java programming language
 
I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Clojure in real life 17.10.2014
Clojure in real life 17.10.2014
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous Applications
 
Are High Level Programming Languages for Multicore and Safety Critical Conver...
Are High Level Programming Languages for Multicore and Safety Critical Conver...Are High Level Programming Languages for Multicore and Safety Critical Conver...
Are High Level Programming Languages for Multicore and Safety Critical Conver...
 
PARADIGM IT.pptx
PARADIGM IT.pptxPARADIGM IT.pptx
PARADIGM IT.pptx
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)
 
Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin Odersky
 

The rise of Functional Programming: From Imperative to Functional