SlideShare a Scribd company logo
Functional Programming
With JavaScript
In the beginning, God created “Programming
paradigms” in 7 days (Genesis 101)👼
Imperative Programming
Procedure Programming
Object Oriented Programming
Functional Programming
~ a coding style / a way of thinking
တူတတောော်တ ောငော်တ ို့
တ ေးတေတောပဲ ဘောထူေးလ ို့လဲ
Q: Don’t we write functions in every language ?
A: But functional programming take it to a whole another level
Def : Break any complex problem down into smaller sub-problems, solve them
using functions, and finally combine them together to solve the bigger
problem.
ဘယော်သူတတွေသေးလ ို့လဲ
F#, C# (.NETs)
Lisp & Perl (grandpas)
Erlang , Elixir & Haskell (hotshots)
Clojure & Scala (JVMs)
D, R, JS, Python, … (sexies)
Why FP in JavaScript
The root of all evil is “this” keyword 😈
Object.prototype
OOP in JS is like sugar coated paracetamol 💊
.call .apply .bind // anyone ?
Input => process => output
f(x) = x * x // function (x) { return x * x }
g(f(x))
“ Programmer think of their programs more
as pipes for data to travel through just like
we did in Math “
Source ~ wellesley.edu
Imperative
let name = “azb”
let greeting = “Hello, I’m ”
console.log(greeting + name)
function greeting(name){
return “Hello, I’m ” + name
}
greeting(“azb”)
Functional
First-class citizen အခွေငော်ို့ထူေးခ လူတေော်ေးစောေး
Treat like other values
Pass around arguments and return as value
Define and manipulate functions from other functions
Reference from variable or self
Side Effects
Changing the value of a variable (parent/ global), OBVIOUSLY
Writing some data to disk, file, console, network
Manipulating of UI
Calling external process
Generally - STATE CHANGED
Pure functions (no side effects)
High-order function (return)
High-order function (accept)
Referential transparency
function add(a, b) { return a + b }
add(add(2, 3), add(4, 1))
add((2 + 3), add(4, 1))
add((2 + 3), (4 + 1))
(2 + 3) + (4 + 1)
Don’t LOOP (stream of data / HO funs)
.forEach
.map
.reduce
.filter
Immutability is bad
.pop .push
.shift .unshift
let a = 1
a = “hello world”
Persistent data structures
var, let, const right ? ahuh not really
Wait a min Object.freeze Object.seal
MORI
IMMUTABLE (sponsored by facebook)
Underscore
Lodash
Ramda
More FP
Currying
Tail Recursion
Pattern matching
Infinite data structure
Composition
Lazy evaluation
self.Q&A
Concurrency
Parallelism
Async
READABLE, EASY TO UNDERSTAND,
REUSABLE
Writing with a larger team
Application larger than a todo app
Performance are not critical
You have to support the project
P.S
1. I/O is tricky in FP
2. Code LineNums are just a number
3. There’s no single true paradigm
Aung Zan Baw - တအောငော်ဇတဘောော်
Web developer (Fairway Technology)
Links
Slides - https://goo.gl/3fmMXk
Best FP in JS - https://goo.gl/IqmkoT
ReactiveX !!!
Starter book - https://goo.gl/ctmBTo

More Related Content

What's hot (20)

PDF
Practical Functional Programming Presentation by Bogdan Hodorog
3Pillar Global
 
PPTX
Dev Concepts: Functional Programming
Svetlin Nakov
 
PDF
Introduction to functional programming
Konrad Szydlo
 
PPT
Introduction To Functional Programming
newmedio
 
PDF
Learning Functional Programming Without Growing a Neckbeard
Kelsey Gilmore-Innis
 
PDF
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...
Fwdays
 
PDF
Functional JavaScript Fundamentals
Srdjan Strbanovic
 
PDF
Intro to functional programming
Assaf Gannon
 
PDF
Java 8: the good parts!
Andrzej Grzesik
 
PPTX
Category theory, Monads, and Duality in the world of (BIG) Data
greenwop
 
PDF
Functional programing in Javascript (lite intro)
Nikos Kalogridis
 
PDF
Java 8 Workshop
Mario Fusco
 
PDF
Intro to functional programming
Assaf Gannon
 
PDF
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
PDF
Some basic FP concepts
Falko Riemenschneider
 
PDF
Being functional in PHP (DPC 2016)
David de Boer
 
ODP
Knolx session
Knoldus Inc.
 
PDF
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Chris Richardson
 
PDF
Halogen: Past, Present, and Future
John De Goes
 
PPT
Scala functions
Knoldus Inc.
 
Practical Functional Programming Presentation by Bogdan Hodorog
3Pillar Global
 
Dev Concepts: Functional Programming
Svetlin Nakov
 
Introduction to functional programming
Konrad Szydlo
 
Introduction To Functional Programming
newmedio
 
Learning Functional Programming Without Growing a Neckbeard
Kelsey Gilmore-Innis
 
"How was it to switch from beautiful Perl to horrible JavaScript", Viktor Tur...
Fwdays
 
Functional JavaScript Fundamentals
Srdjan Strbanovic
 
Intro to functional programming
Assaf Gannon
 
Java 8: the good parts!
Andrzej Grzesik
 
Category theory, Monads, and Duality in the world of (BIG) Data
greenwop
 
Functional programing in Javascript (lite intro)
Nikos Kalogridis
 
Java 8 Workshop
Mario Fusco
 
Intro to functional programming
Assaf Gannon
 
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
Some basic FP concepts
Falko Riemenschneider
 
Being functional in PHP (DPC 2016)
David de Boer
 
Knolx session
Knoldus Inc.
 
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Chris Richardson
 
Halogen: Past, Present, and Future
John De Goes
 
Scala functions
Knoldus Inc.
 

Similar to Functional Programming with JavaScript (20)

ODP
Clojure
alandipert
 
PDF
ClojureScript Introduction
Falko Riemenschneider
 
PPTX
DataWeave 2.0 Language Fundamentals
Joshua Erney
 
PDF
Polyglot Programming @ Jax.de 2010
Andres Almiray
 
PDF
Introduction to clojure
Abbas Raza
 
PPT
OOP
thinkphp
 
PDF
Go Beyond Higher Order Functions: A Journey into Functional Programming
Lex Sheehan
 
PDF
Thinking in Functions: Functional Programming in Python
Anoop Thomas Mathew
 
PDF
Introduction To Scala
Innar Made
 
PPT
Groovy
atonse
 
ODP
Functional programming
S M Asaduzzaman
 
PPTX
Functional programming
Christian Hujer
 
KEY
JavaScript Growing Up
David Padbury
 
ODP
Programming with Freedom & Joy
Hildeberto Mendonça
 
PDF
Fp for the oo programmer
Shawn Button
 
PDF
Refactoring
Amir Barylko
 
PDF
Exploring Clojurescript
Luke Donnet
 
PPTX
Столпы функционального программирования для адептов ООП, Николай Мозговой
Sigma Software
 
KEY
LISP: How I Learned To Stop Worrying And Love Parantheses
Dominic Graefen
 
Clojure
alandipert
 
ClojureScript Introduction
Falko Riemenschneider
 
DataWeave 2.0 Language Fundamentals
Joshua Erney
 
Polyglot Programming @ Jax.de 2010
Andres Almiray
 
Introduction to clojure
Abbas Raza
 
Go Beyond Higher Order Functions: A Journey into Functional Programming
Lex Sheehan
 
Thinking in Functions: Functional Programming in Python
Anoop Thomas Mathew
 
Introduction To Scala
Innar Made
 
Groovy
atonse
 
Functional programming
S M Asaduzzaman
 
Functional programming
Christian Hujer
 
JavaScript Growing Up
David Padbury
 
Programming with Freedom & Joy
Hildeberto Mendonça
 
Fp for the oo programmer
Shawn Button
 
Refactoring
Amir Barylko
 
Exploring Clojurescript
Luke Donnet
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Sigma Software
 
LISP: How I Learned To Stop Worrying And Love Parantheses
Dominic Graefen
 
Ad

Recently uploaded (20)

PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Digital Circuits, important subject in CS
contactparinay1
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Ad

Functional Programming with JavaScript

Editor's Notes

  • #3: Imperative programming where programs are composed of statements which change global state when executed. Programmer act like human, left to right, top to bottom Object Oriented programming where the structures storing your data are the focus of your programming. Programmer spend most of their time thinking how to model your data using objects
  • #7: Stream of data (each item) Prototype base language Java-like OOP syntax via es6 NOT a FP
  • #16: In Connection-oriented communication, a data stream
  • #17: Instead of altering existing values, altered copies are created and the original is preserved