SlideShare una empresa de Scribd logo
1 de 20
WHY JAVASCRIPT FUNCTIONAL
PROGRAMMING
IS SO HARD?
Feb 2, 2016
Welcome to Fantasy Land!
Functional Programming Visualized
Core Functional Concepts
First Class Functions stored in variables, passed as arguments to functions,
created within functions and returned from functions
Higher Order Functions can accept functions as arguments, and/or can return a
function
Pure Functions is a function where the return value is only determined by its
input values, without observable Side Effects
Referential Transparency for a given set of arguments, the same code should
always output the same value, only by changing arguments can a output value be
different
Immutability is an inability for variables to change their values once created. In
other words, all things created stay constant
Core Functional Concepts
Currying / Partial Application - ability of a function to return a new function until
it receives all it's arguments. Calling a curried function with only some of its
arguments is called partial application
Tail Call Optimization - ability to avoid allocating a new stack frame for a function
call. The most common use is tail-recursion, where a recursive function uses
constant stack space.
Pattern matching is a form of conditional branching which allows you to concisely
match on data structure patterns and bind variables at the same time
Lazy Evaluation means that expressions are not evaluated when they are bound
to variables, but their evaluation is deferred until their results are needed by
other computations
Recommended Reading
Mostly Adequate Guide to Functional Programming,
https://drboolean.gitbooks.io/mostly-adequate-guide/content/
Tail call optimization in ECMAScript 6,
http://www.2ality.com/2015/06/tail-call-optimization.html
Functional Pattern Matching in JavaScript,
https://github.com/bramstein/funcy
Functional JavaScript Fundamentals
http://www.slideshare.net/Ssrdjan/functional-javascript-37401024
Want more? Put previously mentioned terms in Twitter ;)))
SO WHY FUNCTIONAL
PROGRAMMING
IS SO HARD?
WHY SO HARD?
Luck of understanding modern JavaScript aka ES6
https://github.com/reactima/reactima-redux-ecosystem/blob/master/JS.md
WHY SO HARD?
Imperative Habits
Most of us spend our lives,
in looping structures and if-then-else statements.
It’s hard to treat functions as variables and see chaining
process
99% of PROGRAMMERS DO THIS
FUNCTIONAL MINDED CODE
WHY SO HARD?
map, http://ramdajs.com/docs/#map
filter, http://ramdajs.com/docs/#filter
concatAll, http://ramdajs.com/docs/#concat
reduce, http://ramdajs.com/docs/#reduce
zip, http://ramdajs.com/docs/#zip
Luck of creativity with the most important functions
* - 80% of functional code in business apps
can be constituted from the above 5 function
WHY SO HARD?
MATH TERMS ARE ANNOYING
Most developers don’t bother to understand
underlying concepts
MONAD
Monad is defined computation as sequences of steps:
a type with a monad structure defines what it means
to chain operations, or nest functions of that type
together.
This allows the programmer to build pipelines that
process data in steps, in which each action
is decorated with additional processing rules provided
by the monad
https://en.wikipedia.org/wiki/Monad_(functional_programming)
Monads in JavaScript, https://curiosity-driven.org/monads-in-javascript
Functors, Applicatives, And Monads In Pictures http://adit.io/posts/2013-04-17-
functors,_applicatives,_and_monads_in_pictures.html
CRAZY?
99% of developers would never bother understand the next slide
WELCOME TO FANTASY LAND!
Spend some time with specification for interoperability
of common algebraic structures in JavaScript
VISIT US!
https://github.com/fantasyland/fantasy-land
DEATH CHART
Issue Open vs. Close Rate Over a Four Month Period
IMPERATIVE HABITS CONTRIBUTE A LOT TO THIS CHART!
NEXT?
I don’t understand concepts!
I just like to do coding!
SHOW ME THE CODE!
I don’t understand concepts!
SHOW ME THE CODE!
READ RAMDA TESTS!
https://github.com/ramda/ramda/tree/master/test
Thank you!
Ilya Sidorov @reactima
Interested to talk?
Let’s have a skype call: ilya.sidorov
1@ilya1.com
https://www.linkedin.com/in/reactima
https://github.com/reactima/

Más contenido relacionado

La actualidad más candente

Function overloading in c++
Function overloading in c++Function overloading in c++
Function overloading in c++Learn By Watch
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India
 
Functions and tasks in verilog
Functions and tasks in verilogFunctions and tasks in verilog
Functions and tasks in verilogNallapati Anindra
 
Notes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and FunctionsNotes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and FunctionsJay Baxi
 
virtual function
virtual functionvirtual function
virtual functionVENNILAV6
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++Jenish Patel
 
Journey of a C# developer into Javascript
Journey of a C# developer into JavascriptJourney of a C# developer into Javascript
Journey of a C# developer into JavascriptMassimo Franciosa
 
Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6Devang Garach
 
Functions in c++
Functions in c++Functions in c++
Functions in c++Maaz Hasan
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional ProgrammingGeison Goes
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default argumentsNikhil Pandit
 
Functional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartFunctional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartChen Fisher
 
Functional programming and ruby in functional style
Functional programming and ruby in functional styleFunctional programming and ruby in functional style
Functional programming and ruby in functional styleNiranjan Sarade
 
Annotation Processing - Demystifying Java's Dark Arts
Annotation Processing - Demystifying Java's Dark ArtsAnnotation Processing - Demystifying Java's Dark Arts
Annotation Processing - Demystifying Java's Dark ArtsJames Kirkbride
 

La actualidad más candente (20)

Function overloading in c++
Function overloading in c++Function overloading in c++
Function overloading in c++
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 Overview
 
Functions and tasks in verilog
Functions and tasks in verilogFunctions and tasks in verilog
Functions and tasks in verilog
 
Inline functions
Inline functionsInline functions
Inline functions
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Notes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and FunctionsNotes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and Functions
 
virtual function
virtual functionvirtual function
virtual function
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++
 
Virtual function
Virtual functionVirtual function
Virtual function
 
Journey of a C# developer into Javascript
Journey of a C# developer into JavascriptJourney of a C# developer into Javascript
Journey of a C# developer into Javascript
 
Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default arguments
 
Functional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartFunctional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smart
 
Functional programming and ruby in functional style
Functional programming and ruby in functional styleFunctional programming and ruby in functional style
Functional programming and ruby in functional style
 
Java script function
Java script functionJava script function
Java script function
 
Create and analyse programs
Create and analyse programsCreate and analyse programs
Create and analyse programs
 
Annotation Processing - Demystifying Java's Dark Arts
Annotation Processing - Demystifying Java's Dark ArtsAnnotation Processing - Demystifying Java's Dark Arts
Annotation Processing - Demystifying Java's Dark Arts
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 

Destacado

Lars thorup-react-and-redux-2016-09
Lars thorup-react-and-redux-2016-09Lars thorup-react-and-redux-2016-09
Lars thorup-react-and-redux-2016-09BestBrains
 
Ramda, a functional JavaScript library
Ramda, a functional JavaScript libraryRamda, a functional JavaScript library
Ramda, a functional JavaScript libraryDerek Willian Stavis
 
Ramda lets write declarative js
Ramda   lets write declarative jsRamda   lets write declarative js
Ramda lets write declarative jsPivorak MeetUp
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioLuis Atencio
 
Introduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScriptIntroduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScripttmont
 
The Aggregation Framework
The Aggregation FrameworkThe Aggregation Framework
The Aggregation FrameworkMongoDB
 

Destacado (7)

Hardcore functional programming
Hardcore functional programmingHardcore functional programming
Hardcore functional programming
 
Lars thorup-react-and-redux-2016-09
Lars thorup-react-and-redux-2016-09Lars thorup-react-and-redux-2016-09
Lars thorup-react-and-redux-2016-09
 
Ramda, a functional JavaScript library
Ramda, a functional JavaScript libraryRamda, a functional JavaScript library
Ramda, a functional JavaScript library
 
Ramda lets write declarative js
Ramda   lets write declarative jsRamda   lets write declarative js
Ramda lets write declarative js
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis Atencio
 
Introduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScriptIntroduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScript
 
The Aggregation Framework
The Aggregation FrameworkThe Aggregation Framework
The Aggregation Framework
 

Similar a WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?

Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programmingsamthemonad
 
379008-rc217-functionalprogramming
379008-rc217-functionalprogramming379008-rc217-functionalprogramming
379008-rc217-functionalprogrammingLuis Atencio
 
React & Redux JS
React & Redux JS React & Redux JS
React & Redux JS Hamed Farag
 
Introduction to functional programming
Introduction to functional programmingIntroduction to functional programming
Introduction to functional programmingThang Mai
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJSLinkMe Srl
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScriptbinDebug WorkSpace
 
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptIntroduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptJohn Stevenson
 
imperative programming language, java, android
imperative programming language, java, androidimperative programming language, java, android
imperative programming language, java, androidi i
 
Aspect-oriented programming in Perl
Aspect-oriented programming in PerlAspect-oriented programming in Perl
Aspect-oriented programming in Perlmegakott
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#Riccardo Terrell
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...Paul Jensen
 
Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Pythondn
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...Codemotion
 
Lecture: Refactoring
Lecture: RefactoringLecture: Refactoring
Lecture: RefactoringMarcus Denker
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
Learn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemtsLearn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemtssiddharth30121
 
PHP 8: What's New and Changed
PHP 8: What's New and ChangedPHP 8: What's New and Changed
PHP 8: What's New and ChangedAyesh Karunaratne
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial BasicsLuca Garulli
 

Similar a WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? (20)

Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programming
 
379008-rc217-functionalprogramming
379008-rc217-functionalprogramming379008-rc217-functionalprogramming
379008-rc217-functionalprogramming
 
React & Redux JS
React & Redux JS React & Redux JS
React & Redux JS
 
Introduction to functional programming
Introduction to functional programmingIntroduction to functional programming
Introduction to functional programming
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJS
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
 
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptIntroduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with Clojurescript
 
imperative programming language, java, android
imperative programming language, java, androidimperative programming language, java, android
imperative programming language, java, android
 
Functional Programming in Java
Functional Programming in JavaFunctional Programming in Java
Functional Programming in Java
 
Aspect-oriented programming in Perl
Aspect-oriented programming in PerlAspect-oriented programming in Perl
Aspect-oriented programming in Perl
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Python
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
 
Unit 2
Unit 2Unit 2
Unit 2
 
Lecture: Refactoring
Lecture: RefactoringLecture: Refactoring
Lecture: Refactoring
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Learn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemtsLearn about SPARK tool and it's componemts
Learn about SPARK tool and it's componemts
 
PHP 8: What's New and Changed
PHP 8: What's New and ChangedPHP 8: What's New and Changed
PHP 8: What's New and Changed
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial Basics
 

Último

Internet of Things Presentation (IoT).pptx
Internet of Things Presentation (IoT).pptxInternet of Things Presentation (IoT).pptx
Internet of Things Presentation (IoT).pptxErYashwantJagtap
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxmibuzondetrabajo
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationMarko4394
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 

Último (17)

Internet of Things Presentation (IoT).pptx
Internet of Things Presentation (IoT).pptxInternet of Things Presentation (IoT).pptx
Internet of Things Presentation (IoT).pptx
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptx
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentation
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 

WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?

  • 1. WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? Feb 2, 2016 Welcome to Fantasy Land!
  • 3. Core Functional Concepts First Class Functions stored in variables, passed as arguments to functions, created within functions and returned from functions Higher Order Functions can accept functions as arguments, and/or can return a function Pure Functions is a function where the return value is only determined by its input values, without observable Side Effects Referential Transparency for a given set of arguments, the same code should always output the same value, only by changing arguments can a output value be different Immutability is an inability for variables to change their values once created. In other words, all things created stay constant
  • 4. Core Functional Concepts Currying / Partial Application - ability of a function to return a new function until it receives all it's arguments. Calling a curried function with only some of its arguments is called partial application Tail Call Optimization - ability to avoid allocating a new stack frame for a function call. The most common use is tail-recursion, where a recursive function uses constant stack space. Pattern matching is a form of conditional branching which allows you to concisely match on data structure patterns and bind variables at the same time Lazy Evaluation means that expressions are not evaluated when they are bound to variables, but their evaluation is deferred until their results are needed by other computations
  • 5. Recommended Reading Mostly Adequate Guide to Functional Programming, https://drboolean.gitbooks.io/mostly-adequate-guide/content/ Tail call optimization in ECMAScript 6, http://www.2ality.com/2015/06/tail-call-optimization.html Functional Pattern Matching in JavaScript, https://github.com/bramstein/funcy Functional JavaScript Fundamentals http://www.slideshare.net/Ssrdjan/functional-javascript-37401024 Want more? Put previously mentioned terms in Twitter ;)))
  • 7. WHY SO HARD? Luck of understanding modern JavaScript aka ES6 https://github.com/reactima/reactima-redux-ecosystem/blob/master/JS.md
  • 8. WHY SO HARD? Imperative Habits Most of us spend our lives, in looping structures and if-then-else statements. It’s hard to treat functions as variables and see chaining process
  • 11. WHY SO HARD? map, http://ramdajs.com/docs/#map filter, http://ramdajs.com/docs/#filter concatAll, http://ramdajs.com/docs/#concat reduce, http://ramdajs.com/docs/#reduce zip, http://ramdajs.com/docs/#zip Luck of creativity with the most important functions * - 80% of functional code in business apps can be constituted from the above 5 function
  • 12. WHY SO HARD? MATH TERMS ARE ANNOYING Most developers don’t bother to understand underlying concepts
  • 13. MONAD Monad is defined computation as sequences of steps: a type with a monad structure defines what it means to chain operations, or nest functions of that type together. This allows the programmer to build pipelines that process data in steps, in which each action is decorated with additional processing rules provided by the monad https://en.wikipedia.org/wiki/Monad_(functional_programming) Monads in JavaScript, https://curiosity-driven.org/monads-in-javascript Functors, Applicatives, And Monads In Pictures http://adit.io/posts/2013-04-17- functors,_applicatives,_and_monads_in_pictures.html
  • 14. CRAZY? 99% of developers would never bother understand the next slide
  • 15. WELCOME TO FANTASY LAND! Spend some time with specification for interoperability of common algebraic structures in JavaScript VISIT US! https://github.com/fantasyland/fantasy-land
  • 16. DEATH CHART Issue Open vs. Close Rate Over a Four Month Period IMPERATIVE HABITS CONTRIBUTE A LOT TO THIS CHART!
  • 17. NEXT? I don’t understand concepts! I just like to do coding! SHOW ME THE CODE! I don’t understand concepts! SHOW ME THE CODE!
  • 19.
  • 20. Thank you! Ilya Sidorov @reactima Interested to talk? Let’s have a skype call: ilya.sidorov 1@ilya1.com https://www.linkedin.com/in/reactima https://github.com/reactima/