KEMBAR78
Fun with Functional JavaScript - Kuba Waliński - Codemotion Rome 2015 | PPT
ROME 27-28 march 2015
Fun with Functional JavaScript
@kubawalinski
kubawalinski@gmail.com
blog.kubawalinski.com
github.com/kubawalinski
ABB Łódź, Poland
Kuba Waliński
ROME 27-28 march 2015 - Speaker’s name
Functional Programming
• Functions as first class citizens
• can be stored in variables and data structures
• higher order functions
• can be passed as arguments to functions
• can be returned from functions
• Pure functions
• always the same result for the same params - caching
• independent from other function calls - parallelism
• no side effects - compiler optimisations
• Immutability
• Recursion
• tail call optimisation
ROME 27-28 march 2015 - Speaker’s name
Functional JavaScript?!
• first class functions :)
• closures :)
• lambdas (anonymous functions) :)
• pure functions :|
• immutability :|
• tail call optimisation :(
ROME 27-28 march 2015 - Speaker’s name
lodash
• very useful "utility belt" library
• port of underscore.js (comes from _)
• provides loads of functions to manipulate
• arrays
• collections
• functions
• objects
• supports curry/partial application
ROME 27-28 march 2015 - Speaker’s name
functional.js
• a functional programming library for JavaScript
• created by Lee Crossley
• in constant development and use
• gaining traction
• 100+ daily npm downloads
• over 40 github stars
• currying implemented by default
• parameter order optimised for partial application
ROME 27-28 march 2015 - Speaker’s name
EcmaScript 6 aka ES.next aka Harmony
• arrow functions
• tail call recursion optimisation
• destructuring arrays and objects
• spread operator
• rest parameters
ROME 27-28 march 2015 - Speaker’s name
Conclusions
• Functional programming in JS is lots of fun!
• A new way to look at the language
• A welcome challenge for every programmer
• Reduces the amount of code you have to
• Write
• Read
• Reason about
• Debug
• Maintain
• Increases code readability
• Rapidly developing
• new frameworks & libraries
• new language features
ROME 27-28 march 2015 - Speaker’s name
Sources
• http://dailyjs.com/2012/09/14/functional-programming/
• https://lodash.com/
• http://functionaljs.com/
• http://nullobject.github.io/fkit/
• http://eliperelman.com/fn.js/
• http://fogus.github.io/lemonad/
• https://leanpub.com/javascript-allonge
• http://www.functionaljavascript.com/
• http://bit.ly/cmr2015-functionaljs
ROME 27-28 march 2015 - Speaker’s name
Leave your feedback on Joind.in!
https://joind.in/event/view/3347
http://bit.ly/cmr2015-feedback
ROME 27-28 march 2015 - Speaker’s name
Leave your feedback on Joind.in!
https://joind.in/event/view/3347
http://bit.ly/cmr2015-feedback

Fun with Functional JavaScript - Kuba Waliński - Codemotion Rome 2015

  • 1.
    ROME 27-28 march2015 Fun with Functional JavaScript @kubawalinski kubawalinski@gmail.com blog.kubawalinski.com github.com/kubawalinski ABB Łódź, Poland Kuba Waliński
  • 2.
    ROME 27-28 march2015 - Speaker’s name Functional Programming • Functions as first class citizens • can be stored in variables and data structures • higher order functions • can be passed as arguments to functions • can be returned from functions • Pure functions • always the same result for the same params - caching • independent from other function calls - parallelism • no side effects - compiler optimisations • Immutability • Recursion • tail call optimisation
  • 3.
    ROME 27-28 march2015 - Speaker’s name Functional JavaScript?! • first class functions :) • closures :) • lambdas (anonymous functions) :) • pure functions :| • immutability :| • tail call optimisation :(
  • 4.
    ROME 27-28 march2015 - Speaker’s name lodash • very useful "utility belt" library • port of underscore.js (comes from _) • provides loads of functions to manipulate • arrays • collections • functions • objects • supports curry/partial application
  • 5.
    ROME 27-28 march2015 - Speaker’s name functional.js • a functional programming library for JavaScript • created by Lee Crossley • in constant development and use • gaining traction • 100+ daily npm downloads • over 40 github stars • currying implemented by default • parameter order optimised for partial application
  • 6.
    ROME 27-28 march2015 - Speaker’s name EcmaScript 6 aka ES.next aka Harmony • arrow functions • tail call recursion optimisation • destructuring arrays and objects • spread operator • rest parameters
  • 7.
    ROME 27-28 march2015 - Speaker’s name Conclusions • Functional programming in JS is lots of fun! • A new way to look at the language • A welcome challenge for every programmer • Reduces the amount of code you have to • Write • Read • Reason about • Debug • Maintain • Increases code readability • Rapidly developing • new frameworks & libraries • new language features
  • 8.
    ROME 27-28 march2015 - Speaker’s name Sources • http://dailyjs.com/2012/09/14/functional-programming/ • https://lodash.com/ • http://functionaljs.com/ • http://nullobject.github.io/fkit/ • http://eliperelman.com/fn.js/ • http://fogus.github.io/lemonad/ • https://leanpub.com/javascript-allonge • http://www.functionaljavascript.com/ • http://bit.ly/cmr2015-functionaljs
  • 9.
    ROME 27-28 march2015 - Speaker’s name Leave your feedback on Joind.in! https://joind.in/event/view/3347 http://bit.ly/cmr2015-feedback
  • 10.
    ROME 27-28 march2015 - Speaker’s name Leave your feedback on Joind.in! https://joind.in/event/view/3347 http://bit.ly/cmr2015-feedback