SlideShare une entreprise Scribd logo
1  sur  39
Télécharger pour lire hors ligne
1
Functional Programming
in JavaScript & ESNext
Navin Singh, ThoughtWorks, @official_naveen
Ram Shinde, ThoughtWorks, @ramshinde92
Flock (Group of Birds)
Conjoin = Add ( + )
A B C
( x ) Breed = Multiply
A Function
● Takes a value
● Results through a return value
SAME
A Pure Function
● Takes a value, and operates only
on that value
● Given the same Input, always
gives the same Output
-------------------------------------------------------
No side effects
Domain to Range (Pure Functions)
Side Effects
- Anything occurring in our function body other than the computation of a
result.
- Observable interaction with the outside world
- List may include
- Making an API call
- Querying/Updating the DOM
- Mutations
- Interaction with FS
Functional Programming
History Definition
History
● Modelling computation
● Express computation in terms of units of expression
● A lambda Expression defines
○ Function parameters
○ Body
● Lambda Calculus by Alonzo Church
Definition
A Paradigm where computation is performed through expressions, avoiding
mutations.
The real enemy… is unexpected dependency and mutation of state, which
functional programming solves more directly and completely.
- John Carmack
Some tools
● Higher Order Functions
● Curry
● Compose
● Functors
Declarative - Do not iterate
It’s like writing expression, as opposed to step by step instructions.
It specifies what, and not how.
Higher Order Function
A Higher Order Function is a function that accepts a function as one of its
parameters and/or returns a function.
Map, Filter & Reduce are widely used.
Higher Order Function - Example
Tools - Currying
Composition
Composition - Example
Type Signatures
Type Signatures
What are they ?
They are meta language helping to understand the expression more effectively.
Why do we need them ?
Can be thought as type annotations in functional programming.
For Eg:- Typescript, Flow
System Used to define: Hindley Milner
Functors
Functors (Maybe)
Advantages of Pure Functions
● Cacheable
● Lazy Evaluation
● Referential Transparency
● Testable
● Parallel
Languages that encourage/support Functional
Programming
● Haskell
● Elm
● Erlang
● F#
● Clojure
● Scala
● OCaml
● JavaScript
Functional JavaScript Libraries
● Ramda
● Lodash/fp
● Immutable.js
● Mori.js
● RxJS
● Functional.js
● FolkTale.js
References
Mostly Adequate Guide to Functional Programming - Dr. Frisby
Functional Programming Basics in ES6 - Coding Tech
Functional Programming Series - FunFunFunction
Learning Functional Programming - Anjana Vakil
What is a functor?
Awesome FP JS
ESNext
1. What is ESNext?
2. Who designs ECMAScript?
3. How is it designed?
0 Strawman
1 Proposal
2 Draft
3 Candidate
4 Finished
What is ESNext
ESNext, simply put is the future version of ECMAScript, its nothing more that
one the weird naming conventions JS is famous for.
Who designs ECMAScript
European Computer Manufacturers Association (ECMA) is standards
organisation based in Geneva responsible for developing various standards in
this case ECMAScript code named ECMA-262.
How it's designed?
Stage 0: Strawman
- A free form way of submitting ideas, either from TC39 member or non-
member.
Stage 1: Proposal
- Make the case for the addition
- Describe the shape of a solution
- Prose outlining the problem or need and the general shape of a solution
Draft, Candidate & Finished
Stage 2: Draft
- 1st Version. Inclusion is likely.
- Requirement: Complete description is needed here.
Stage 3: Candidate
- Proposal is almost finished, waiting for feedback.
- Requirement: Spec must be complete
Stage 4: Finished
- Proposal is ready
- Requirement: TEST 262 acceptance
How to use ESNext
Use Babel with various presets:
● babel-preset-es2015, 2016, 2017 for specific versions
● "env" for including all the above versions
● ES2018 the only feature in pipeline which is actually called Pipeline is
under proposal and has its own Babel preset called @babel/plugin-proposal-
pipeline-operator
ECMAScript 2015
● Scoping: let and const
● Arrow Functions
● Parameter handling: default
params, rest params
● String interpolation
● Module import and export
● Class definitions
● Class inheritance
● Array.find()
● Spread operator
ECMAScript 2016
● Array.prototype.includes
ECMAScript 2016
● Exponentiation operator
ECMAScript 2017
ECMAScript 2017
Object.entries & values
ECMAScript 2018
Rest/Spread operator
Async Iteration
Pipeline Operator
References
TC39 Proposals : https://github.com/tc39
ECMAScript : https://en.wikipedia.org/wiki/ECMAScript
ECMA International : https://en.wikipedia.org/wiki/Ecma_International
Pipeline Operator : https://github.com/tc39/proposal-pipeline-operator
Babel : https://babeljs.io/
ESNext : https://github.com/esnext/esnext
THANK YOU
Ram Shinde
UI Developer, ThoughtWorks
ramks@thoughtworks.com
Navin Singh
UI Developer, ThoughtWorks
navinks@thoughtwoks.com
@ramshinde92 @official_naveen

Contenu connexe

Tendances

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
 
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)PROIDEA
 
Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)lennartkats
 
Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Calvin Cheng
 
The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)lennartkats
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languagesMikhail Barash
 
Functional Programming in Python
Functional Programming in PythonFunctional Programming in Python
Functional Programming in PythonHaim Michael
 
Typed Drupal - A great combination of Drupal 8 and PHP 7
Typed Drupal - A great combination of Drupal 8 and PHP 7Typed Drupal - A great combination of Drupal 8 and PHP 7
Typed Drupal - A great combination of Drupal 8 and PHP 7Aditya Ghan
 
PHP = PHunctional Programming
PHP = PHunctional ProgrammingPHP = PHunctional Programming
PHP = PHunctional ProgrammingLuis Atencio
 
C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?Christian Nagel
 
Learn To Code: Introduction to c
Learn To Code: Introduction to cLearn To Code: Introduction to c
Learn To Code: Introduction to cSadhanaParameswaran
 
Functional JavaScript Fundamentals
Functional JavaScript FundamentalsFunctional JavaScript Fundamentals
Functional JavaScript FundamentalsSrdjan Strbanovic
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? reactima
 
The security professional's guide to programming - Eric Vanderburg
The security professional's guide to programming - Eric VanderburgThe security professional's guide to programming - Eric Vanderburg
The security professional's guide to programming - Eric VanderburgEric Vanderburg
 
Keywords in python
Keywords in pythonKeywords in python
Keywords in pythonPushpakBhoge
 

Tendances (20)

Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
 
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
 
Hanoi JUG: Java 8 & lambdas
Hanoi JUG: Java 8 & lambdasHanoi JUG: Java 8 & lambdas
Hanoi JUG: Java 8 & lambdas
 
Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)
 
Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)
 
The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languages
 
Functional Programming in Python
Functional Programming in PythonFunctional Programming in Python
Functional Programming in Python
 
Typed Drupal - A great combination of Drupal 8 and PHP 7
Typed Drupal - A great combination of Drupal 8 and PHP 7Typed Drupal - A great combination of Drupal 8 and PHP 7
Typed Drupal - A great combination of Drupal 8 and PHP 7
 
PHP = PHunctional Programming
PHP = PHunctional ProgrammingPHP = PHunctional Programming
PHP = PHunctional Programming
 
C# language
C# languageC# language
C# language
 
C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?C# 9 and 10 - What's cool?
C# 9 and 10 - What's cool?
 
2nd presantation
2nd presantation2nd presantation
2nd presantation
 
Learn To Code: Introduction to c
Learn To Code: Introduction to cLearn To Code: Introduction to c
Learn To Code: Introduction to c
 
Functional JavaScript Fundamentals
Functional JavaScript FundamentalsFunctional JavaScript Fundamentals
Functional JavaScript Fundamentals
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
 
C++
C++C++
C++
 
The security professional's guide to programming - Eric Vanderburg
The security professional's guide to programming - Eric VanderburgThe security professional's guide to programming - Eric Vanderburg
The security professional's guide to programming - Eric Vanderburg
 
C++ ch1
C++ ch1C++ ch1
C++ ch1
 
Keywords in python
Keywords in pythonKeywords in python
Keywords in python
 

Similaire à Functional Programming in JavaScript & ESNext

Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scaladatamantra
 
(3) cpp procedural programming
(3) cpp procedural programming(3) cpp procedural programming
(3) cpp procedural programmingNico Ludwig
 
Python functional programming
Python functional programmingPython functional programming
Python functional programmingGeison Goes
 
Functional Programming - Worth the Effort
Functional Programming - Worth the EffortFunctional Programming - Worth the Effort
Functional Programming - Worth the EffortBoldRadius Solutions
 
Introduction to functional programming
Introduction to functional programmingIntroduction to functional programming
Introduction to functional programmingKonrad Szydlo
 
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)goccy
 
New c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_ivNew c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_ivNico Ludwig
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptxKarthickT28
 
Intro to java 8
Intro to java 8Intro to java 8
Intro to java 8John Godoi
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...Charles Beyer
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptxmiki304759
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationTim Burks
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesSchwannden Kuo
 
Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3Adam McConnell
 
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...Azilen Technologies Pvt. Ltd.
 
Functional programming
Functional programmingFunctional programming
Functional programmingPiumiPerera7
 
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Ovidiu Farauanu
 

Similaire à Functional Programming in JavaScript & ESNext (20)

Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
(3) cpp procedural programming
(3) cpp procedural programming(3) cpp procedural programming
(3) cpp procedural programming
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
 
Functional Programming - Worth the Effort
Functional Programming - Worth the EffortFunctional Programming - Worth the Effort
Functional Programming - Worth the Effort
 
Introduction to functional programming
Introduction to functional programmingIntroduction to functional programming
Introduction to functional programming
 
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
 
New c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_ivNew c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_iv
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
 
TypeScript Overview
TypeScript OverviewTypeScript Overview
TypeScript Overview
 
Intro to java 8
Intro to java 8Intro to java 8
Intro to java 8
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
GooglePropsal
GooglePropsalGooglePropsal
GooglePropsal
 
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptx
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminaries
 
Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3Adam_Mcconnell_SPR11_v3
Adam_Mcconnell_SPR11_v3
 
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
Apple’s New Swift Programming Language Takes Flight With New Enhancements And...
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
 

Plus de Unfold UI

Normalization in Redux
Normalization in ReduxNormalization in Redux
Normalization in ReduxUnfold UI
 
VueJs Workshop
VueJs WorkshopVueJs Workshop
VueJs WorkshopUnfold UI
 
Static Type Checking with FlowJs
Static Type Checking with FlowJsStatic Type Checking with FlowJs
Static Type Checking with FlowJsUnfold UI
 
React Component in scala.js
React Component in scala.jsReact Component in scala.js
React Component in scala.jsUnfold UI
 
Forms, Components & Considerations
Forms, Components & ConsiderationsForms, Components & Considerations
Forms, Components & ConsiderationsUnfold UI
 
2D Page Layout
2D Page Layout2D Page Layout
2D Page LayoutUnfold UI
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web AppsUnfold UI
 

Plus de Unfold UI (7)

Normalization in Redux
Normalization in ReduxNormalization in Redux
Normalization in Redux
 
VueJs Workshop
VueJs WorkshopVueJs Workshop
VueJs Workshop
 
Static Type Checking with FlowJs
Static Type Checking with FlowJsStatic Type Checking with FlowJs
Static Type Checking with FlowJs
 
React Component in scala.js
React Component in scala.jsReact Component in scala.js
React Component in scala.js
 
Forms, Components & Considerations
Forms, Components & ConsiderationsForms, Components & Considerations
Forms, Components & Considerations
 
2D Page Layout
2D Page Layout2D Page Layout
2D Page Layout
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 

Dernier

OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainAbdul Ahad
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 

Dernier (20)

OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software Domain
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 

Functional Programming in JavaScript & ESNext

  • 1. 1
  • 2. Functional Programming in JavaScript & ESNext Navin Singh, ThoughtWorks, @official_naveen Ram Shinde, ThoughtWorks, @ramshinde92
  • 3. Flock (Group of Birds) Conjoin = Add ( + ) A B C ( x ) Breed = Multiply
  • 4. A Function ● Takes a value ● Results through a return value
  • 5. SAME A Pure Function ● Takes a value, and operates only on that value ● Given the same Input, always gives the same Output ------------------------------------------------------- No side effects
  • 6. Domain to Range (Pure Functions)
  • 7. Side Effects - Anything occurring in our function body other than the computation of a result. - Observable interaction with the outside world - List may include - Making an API call - Querying/Updating the DOM - Mutations - Interaction with FS
  • 9. History ● Modelling computation ● Express computation in terms of units of expression ● A lambda Expression defines ○ Function parameters ○ Body ● Lambda Calculus by Alonzo Church
  • 10. Definition A Paradigm where computation is performed through expressions, avoiding mutations. The real enemy… is unexpected dependency and mutation of state, which functional programming solves more directly and completely. - John Carmack
  • 11. Some tools ● Higher Order Functions ● Curry ● Compose ● Functors
  • 12. Declarative - Do not iterate It’s like writing expression, as opposed to step by step instructions. It specifies what, and not how.
  • 13. Higher Order Function A Higher Order Function is a function that accepts a function as one of its parameters and/or returns a function. Map, Filter & Reduce are widely used.
  • 19. Type Signatures What are they ? They are meta language helping to understand the expression more effectively. Why do we need them ? Can be thought as type annotations in functional programming. For Eg:- Typescript, Flow System Used to define: Hindley Milner
  • 22. Advantages of Pure Functions ● Cacheable ● Lazy Evaluation ● Referential Transparency ● Testable ● Parallel
  • 23. Languages that encourage/support Functional Programming ● Haskell ● Elm ● Erlang ● F# ● Clojure ● Scala ● OCaml ● JavaScript
  • 24. Functional JavaScript Libraries ● Ramda ● Lodash/fp ● Immutable.js ● Mori.js ● RxJS ● Functional.js ● FolkTale.js
  • 25. References Mostly Adequate Guide to Functional Programming - Dr. Frisby Functional Programming Basics in ES6 - Coding Tech Functional Programming Series - FunFunFunction Learning Functional Programming - Anjana Vakil What is a functor? Awesome FP JS
  • 26. ESNext 1. What is ESNext? 2. Who designs ECMAScript? 3. How is it designed? 0 Strawman 1 Proposal 2 Draft 3 Candidate 4 Finished
  • 27. What is ESNext ESNext, simply put is the future version of ECMAScript, its nothing more that one the weird naming conventions JS is famous for. Who designs ECMAScript European Computer Manufacturers Association (ECMA) is standards organisation based in Geneva responsible for developing various standards in this case ECMAScript code named ECMA-262.
  • 28. How it's designed? Stage 0: Strawman - A free form way of submitting ideas, either from TC39 member or non- member. Stage 1: Proposal - Make the case for the addition - Describe the shape of a solution - Prose outlining the problem or need and the general shape of a solution
  • 29. Draft, Candidate & Finished Stage 2: Draft - 1st Version. Inclusion is likely. - Requirement: Complete description is needed here. Stage 3: Candidate - Proposal is almost finished, waiting for feedback. - Requirement: Spec must be complete Stage 4: Finished - Proposal is ready - Requirement: TEST 262 acceptance
  • 30. How to use ESNext Use Babel with various presets: ● babel-preset-es2015, 2016, 2017 for specific versions ● "env" for including all the above versions ● ES2018 the only feature in pipeline which is actually called Pipeline is under proposal and has its own Babel preset called @babel/plugin-proposal- pipeline-operator
  • 31. ECMAScript 2015 ● Scoping: let and const ● Arrow Functions ● Parameter handling: default params, rest params ● String interpolation ● Module import and export ● Class definitions ● Class inheritance ● Array.find() ● Spread operator
  • 38. References TC39 Proposals : https://github.com/tc39 ECMAScript : https://en.wikipedia.org/wiki/ECMAScript ECMA International : https://en.wikipedia.org/wiki/Ecma_International Pipeline Operator : https://github.com/tc39/proposal-pipeline-operator Babel : https://babeljs.io/ ESNext : https://github.com/esnext/esnext
  • 39. THANK YOU Ram Shinde UI Developer, ThoughtWorks ramks@thoughtworks.com Navin Singh UI Developer, ThoughtWorks navinks@thoughtwoks.com @ramshinde92 @official_naveen

Notes de l'éditeur

  1. Add some more pointers
  2. Talk about why this comment in code is valid.
  3. Add slide for What is ESNext and Who designs ECMAScript Who designs it => TC39 How is it designed => 5 stages ES6 with house full of features was a problem So TC39 came with 5 stages solution thereby releasing features frequently
  4. Add slide for What is ESNext and Who designs ECMAScript Who designs it => TC39 How is it designed => 5 stages ES6 with house full of features was a problem So TC39 came with 5 stages solution thereby releasing features frequently
  5. Stage 1: Champion must be identified who is responsible for proposal, Champion or co-champion must be member of TC39
  6. Stage 4: ECMAScript spec editor must sign off All these stages are not confirmations, they are just probables Confirmation is after they clear spec editor
  7. Stage 4: ECMAScript spec editor must sign off All these stages are not confirmations, they are just probables Confirmation is after they clear spec editor