Javascript is awesome, and asynchronous. But some libraries are made by egocentric people : how to contain all DB interaction to the connection callback? Does the Callback soup a fatality? This talk help you to use data structure to keep safe your code. Some great ideas are comming from the functional programing world. How to use it with javascript browser and/or node.js? Is it really complicated?
I write this talk because I use node.js a lot and write a lot of fix in my code to abstract database driver (couchbase, mongo, postgre...). I found an effective way to solve problems using functional programing data structure. But this talk is not for nerd or claiming functional programing superiority : some tools are cool, make your code cleanest and modular, so use it !
15. SO, WE HAVE A PROBLEM : HOW TO USE
A VALUE WE DON’T HAVE YET, AND USE
IT IN THE FUTURE?
16. CHANGE YOUR MIND
HOW DO YOU INTERACT WITH
DATA NOW?
• Wait for it
• Possibly
blocking
i/o
Get data
from DB
and/or
WS
• Act on it
• Data
treatment
Data is
here
21. CHANGE YOUR MIND
HOW CAN WE DO IT?
• Give all the
“recipes” about
how to deal
with this data
• You only
describe how
to manage
data you get
Get data
from DB
and/or
WS
That’s all
34. WE’VE JUST DEALT
WITH FUNCTORS,
MONADS,
SEMIGROUPS… ALL
OF THESE
ALGEBRAIC
STRUCTURES
35. MATH WORDS, NOT SO COMPLICATED,
JUST MADE TO SHARE CONCEPTS
BETWEEN PEOPLE :-)
36. FUNCTIONAL
PROGRAMING IS NOT
A LANGUAGE : IT’S
THE ABILITY TO USE
ALGEBRAIC
STRUCTURES AND
MATH TOOLS IN YOUR
CODE
SO YOU CAN REUSE IT WHERE YOU WANT…
37. Made by the awesome Brian McKenna - @puffnfresh
FUNCTIONAL JAVASCRIPT : FANTASY
LAND SPECIFICATION AND CODE