Your SlideShare is downloading. ×
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Use Promises, Futures and some functional programing stuff without being a math nerd
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Use Promises, Futures and some functional programing stuff without being a math nerd

2,651

Published on

talk given to the take off conference 2014 about promises and futures in javascript world https://www.youtube.com/watch?v=2OjHNe9Akaw

talk given to the take off conference 2014 about promises and futures in javascript world https://www.youtube.com/watch?v=2OjHNe9Akaw

Published in: Technology, Education
3 Comments
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
2,651
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
7
Comments
3
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. USE PROMISES, FUTURES AND SOME FUNCTIONAL PROGRAMING STUFF WITHOUT BEING A MATH NERD. @WAXZCE TAKEOFF CONFERENCE
  • 2. WHO AM I ? CEO at www.clever-cloud.com Polyglot developer @waxzce on twitter
  • 3. KEEP YOUR APPS ONLINE. MADE WITH NODE.JS, SCALA, JAVA, RUBY, PHP, PYTHON, GO… And learn a lot of things about your code, apps, and good/bad design…
  • 4. I’M NOT A MATH NERD
  • 5. NODE.JS MAIN PROBLEM
  • 6. SO, TRY TO KEEP IT ALIVE AND MINIMIZE ERROR EXPOSURE
  • 7. ON THE OTHER HAND: THE CALLBACK SOUP
  • 8. EXAMPLE : DATABASE CONNECTION
  • 9. REALLY ? ALL DB INTERACTION IN ONE CALLBACK ?
  • 10. REALLY ? UNCATCHED EXCEPTIONS BUBBLE TO THE TOP AND KILL THE APP ?
  • 11. REALLY ? IF/ELSE/UNDEFINED ERROR TREATMENT ?
  • 12. DB DRIVER SHOULDN’T DRIVE YOUR CODE ARCHITECTURE, THEORICALLY
  • 13. SO, WE HAVE A PROBLEM : HOW TO USE A VALUE WE DON’T HAVE YET, AND USE IT IN THE FUTURE?
  • 14. CHANGE YOUR MIND HOW DO YOU INTERACT WITH DATA NOW? Get data from DB and/or WS • Wait for it • Possibly blocking i/o Data is here • Act on it • Data treatment
  • 15. EXAMPLE
  • 16. YOU WANT TO RETURN SOMETHING !
  • 17. THE OTHER PROBLEM : YOU MIX I/O HANDLING WITH YOUR BUSINESS PROCESSES
  • 18. SPLIT Business process and valued computing I/O management and other “computing stuff”
  • 19. CHANGE YOUR MIND HOW CAN WE DO IT? Get data from DB and/or WS • Give all the “recipes” about how to deal with this data • You only describe how to manage data you get That’s all
  • 20. WORK ON FUTURE DATA YOU HAVE PROMISED TO YOUR CODE ;-)
  • 21. EXAMPLE SIMPLE PROMISE MAP
  • 22. EXAMPLE SIMPLE PROMISE MAP
  • 23. MORE IMPORTANT : YOU CAN RETURN A DATA YOU DON’T HAVE AT THE MOMENT
  • 24. NO MORE DEALING WITH BLOCKING I/O IN YOUR BUSINESS CODE
  • 25. DEALING WITH MULTIPLE FUTURE DATA
  • 26. GET ALL YOU NEED TO WORK And stop using boolean counter for event « ready »….
  • 27. REAL WORLD EXAMPLE
  • 28. BUILT IN ERROR MANAGEMENT
  • 29. SIMPLE WAY : YOU CAN RETURN SOMETING :-)
  • 30. PROMISES WILL MANAGE TEMPORALITY PROBLEMS AND I/O IN A SIMPLE WAY
  • 31. NOT TOO COMPLICATED ?
  • 32. WE’VE JUST DEALT WITH FUNCTORS, MONADS, SEMIGROUPS… ALL OF THESE ALGEBRAIC STRUCTURES
  • 33. MATH WORDS, NOT SO COMPLICATED, JUST MADE TO SHARE CONCEPTS BETWEEN PEOPLE :-)
  • 34. 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…
  • 35. FUNCTIONAL JAVASCRIPT : FANTASY LAND SPECIFICATION Made by the awesome Brian McKenna - @puffnfresh
  • 36. DEMO MADE WITH PACTA IMPLEMENTATION Node.js + browser implementation, totally agnostic javascript, Fantasy Land compatible + Promises/A+ compatible made by Paul Mucur with help from Rodolphe Belouin
  • 37. TRY IT YOU WILL
  • 38. BE A BADASS !
  • 39. THANK YOU ! ANY QUESTIONS ? I’m on twitter : @waxzce I give you a www.clevercloud.com gift : takeoff2014

×