Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Introduction to Functional Reactive Programming

4.517 Aufrufe

Veröffentlicht am

Introduction to Functional Reactive Programming

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

Introduction to Functional Reactive Programming

  1. 1. Reactive Thinking fb.me/dangthaison.91 | @dangthaison91
  2. 2. Functional Reactive Programming
  3. 3. 1. What is FRP?
  4. 4. Functional + Reactive
  5. 5. Microsoft Excel
  6. 6. a = b + c
  7. 7. FRP: Streams of values over time
  8. 8. Core of FRP is Signal
  9. 9. Signal emits value over the time
  10. 10. FRP is Declarative
  11. 11. Imperative Write correct sequence of codes in the correct order. Step by step. (How) Declarative Write code to describes what you want to do.
  12. 12. 2. Why is FRP?
  13. 13. Example 1 Search API as you type but: - Don't spam API server every seconds - Only make request if keyword changed - Cancel previous requests
  14. 14. Imperative
  15. 15. Declarative
  16. 16. Example 2 When the user starts simultaneously panning and rotating an object, start a countdown from 3. Stop the timer either when the countdown ends or when the user stops the gestures.
  17. 17. Imperative
  18. 18. Imperative
  19. 19. Imperative - When the user touches the screen - Check if a user is panning an object, store that information - Check if both gestures are running simultaneously - start a timer, from 3, counting down. - Check if the user is rotating an object, store that information - Check if both gestures are running simultaneously - start a timer, from 3, counting down. - Check if the user stopped panning - Stop the timer if needed - Check if the user stopped rotating - Stop the timer if needed - When the timer ticks, decrease the number of seconds left - If the number of seconds left is zero, stop the timer*
  20. 20. There is a Better Way!
  21. 21. Declarative
  22. 22. Declarative
  23. 23. Declarative
  24. 24. Declarative
  25. 25. Declarative
  26. 26. Declarative Define condition “simultaneously `panning` and `rotating`” Define condition “start a countdown from `3`” Define condition “when the user stops the gestures” Define what a timer is When the user starts simultaneously `panning` and `rotating` an object, start a countdown from `3`. Stop the timer either when the countdown ends or when the user stops the gestures.”
  27. 27. Advantages • Code more concise & clear, easy to understand without context • Readability, highly express • Make Asynchronous easier • UI Binding • Maintainability, Extensibility ...
  28. 28. Imperative
  29. 29. Declarative
  30. 30. What we can do • Observables • Transformations • Composition • Combination • Filter • Buffer ...
  31. 31. Denial • FRP is hard, imperative is more easier • FRP just is trend! • Just another Framework • Unnecessarily complex
  32. 32. 3. Thinking in Reactive
  33. 33. FRP is hard, but it is SIMPLE
  34. 34. Imperative is EASY
  35. 35. Simple vs Easy
  36. 36. Complexity
  37. 37. Simple made Easy — Rick Hickey
  38. 38. FRP is good Trend
  39. 39. Functional Reactive will be RADIOACTIVE
  40. 40. More: https://goo.gl/lfNWlJ Blog: https://dangthaison91.wordpress.com
  41. 41. Thank you!

×