a survey on reactive programming
play

A Survey on Reactive Programming Engineer Bainomugisha, Andoni - PowerPoint PPT Presentation

A Survey on Reactive Programming Engineer Bainomugisha, Andoni Lombide Carreton, Tom Van Cutsem, Stijn Mostinckx, Wolfgang De Meuter ACM Computing Surveys (CSUR) 2013 PLaNES reading club 21 Jan 2015 Languages 6 Dimensions (


  1. “A Survey on Reactive Programming” Engineer Bainomugisha, Andoni Lombide Carreton, Tom Van Cutsem, Stijn Mostinckx, Wolfgang De Meuter ACM Computing Surveys (CSUR) – 2013 PLaNES reading club 21 Jan 2015

  2. Languages 6 Dimensions ( Language Basic abstractions Evaluation Lifting Multidirectionality Glitch Support for model avoidance distribution FRP Siblings Fran behaviours and events Pull Explicit N Y N Yampa signal functions and Pull Explicit N Y N events FrTime behaviours and events Push Implicit N Y N NewFran behaviours and events Push and Explicit N Y N Pull Frapp´ e behaviours and events Push Explicit N N N Scala.React signals and events Push Manual N Y N Flapjax behaviours and events Push Explicit and N Y (local) Y implicit AmbientTalk/R behaviours and events Push Implicit N Y (local) Y Cousins of Reactive Programming Cells rules, cells and ob- Push Manual N Y N servers Lamport Cells reactors and reporters Push and Manual N N Y Pull SuperGlue signals, components, Push Manual N Y N and rules Trellis cells and rules Push Manual N Y* N Radul/Sussman propagators and cells Push Manual Y N N Propagators Coherence reactions and actions Pull N/A Y Y N .NET Rx events Push Manual N N? N

  3. Languages 6 Dimensions ( Language Basic abstractions Evaluation Lifting Multidirectionality Glitch Support for model avoidance distribution FRP Siblings Fran behaviours and events Pull Explicit N Y N Yampa signal functions and Pull Explicit N Y N events FrTime behaviours and events Push Implicit N Y N Christophe’s paper next time NewFran behaviours and events Push and Explicit N Y N Pull Frapp´ e behaviours and events Push Explicit N N N Scala.React signals and events Push Manual N Y N Flapjax behaviours and events Push Explicit and N Y (local) Y implicit AmbientTalk/R behaviours and events Push Implicit N Y (local) Y Cousins of Reactive Programming VUB’s work Cells rules, cells and ob- Push Manual N Y N servers Lamport Cells reactors and reporters Push and Manual N N Y Pull SuperGlue signals, components, Push Manual N Y N and rules Trellis cells and rules Push Manual N Y* N Radul/Sussman propagators and cells Push Manual Y N N Propagators Coherence reactions and actions Pull N/A Y Y N .NET Rx events Push Manual N N? N

  4. Reactive programming • for event-driven and interactive applications e.g., GUIs, web-apps • express time-varying values • automatically manage dependencies between such values • abstract over time management • like spreadsheets : 
 change 1 cell => others are recalculated

  5. Example 1 var1 = 1 var1 3 var2 = 2 + var3 = var1 + var2 var3 2 var2

  6. Example 1 var1 = 1 var1 3 var2 = 2 + var3 = var1 + var2 var3 2 var2 Stream ¡ s1 ¡= ¡new ¡Stream(“1”); ¡ Stream ¡ s2 ¡= ¡new ¡Stream(“2”); ¡ Stream ¡ s3 ¡= ¡Stream. add ( s1 , s2 );

  7. “Callback Hell” [Edw09] • Lots of event handlers - asynchronous callbacks • Manipulating the same data - unpredictable order • No return value => update state via side-effects

  8. The 6 dimensions 1. representation of time-varying values 2. evaluation model 3. lifting operations 4. multi-directionality 5. glitch avoidance Conflicting 6. support for distribution

  9. The 6 dimensions 1. representation of time-varying values 2. evaluation model Host languages: ✦ Haskell 3. lifting operations ✦ Scala ✦ Scheme/Racket ✦ JavaScript 4. multi-directionality ✦ Java ✦ Python 5. glitch avoidance ✦ C#.Net ✦ … 6. support for distribution

  10. 1. Basic abstractions What is manipulated? Behaviour ✦ time-varying values ✦ continuously changing over time ✦ e.g.: “seconds” ¡“seconds*10” Events ✦ (maybe infinite) streams of values ✦ discrete point in time ✦ e.g.: “key-­‑press” ¡“merge” ¡“filter”

  11. Language Basic abstractions Evaluation Lifting Multidirectionality model FRP Siblings Fran behaviours and events Pull Explicit N Yampa signal functions and Pull Explicit N events FrTime behaviours and events Push Implicit N NewFran behaviours and events Push and Explicit N Pull Frapp´ e behaviours and events Push Explicit N Scala.React signals and events Push Manual N Flapjax behaviours and events Push Explicit and N implicit AmbientTalk/R behaviours and events Push Implicit N Cousins of Reactive Programming Cells rules, cells and ob- Push Manual N servers Lamport Cells reactors and reporters Push and Manual N Pull SuperGlue signals, components, Push Manual N and rules Trellis cells and rules Push Manual N Radul/Sussman propagators and cells Push Manual Y Propagators Coherence reactions and actions Pull N/A Y .NET Rx events Push Manual N

  12. 2. Evaluation model Who triggers sending of messages? Pull-based - good for continuous streams ✦ consumer asks for value ✦ like a method call ✦ demand-driven propagation ✦ result of lazy evaluation (e.g., in Haskell) Push-based - good for discrete events ✦ producer pushes data based on availability ✦ data-driven propagation ✦ followed by most recent implementations

  13. Language Basic abstractions Evaluation Lifting Multidirectionality Glitch model avoidance FRP Siblings Fran behaviours and events Pull Explicit N Y Yampa signal functions and Pull Explicit N Y events FrTime behaviours and events Push Implicit N Y NewFran behaviours and events Push and Explicit N Y Pull Frapp´ e behaviours and events Push Explicit N N Scala.React signals and events Push Manual N Y Flapjax behaviours and events Push Explicit and N Y (local) implicit AmbientTalk/R behaviours and events Push Implicit N Y (local) Cousins of Reactive Programming Cells rules, cells and ob- Push Manual N Y servers Lamport Cells reactors and reporters Push and Manual N N Pull SuperGlue signals, components, Push Manual N Y and rules Trellis cells and rules Push Manual N Y* Radul/Sussman propagators and cells Push Manual Y N Propagators Coherence reactions and actions Pull N/A Y Y .NET Rx events Push Manual N N?

  14. 3. Lifting add ¡: ¡(Int,Int) ¡-­‑> ¡Int lift (add) ¡: ¡ (Stream<Int>,Stream<Int>) ¡ -­‑> ¡Stream<Int> ✦ Map operations to all elements of the streams ✦ Registers a dependency graph (In the paper: Stream <-> Behaviour/Events)

  15. 3. Lifting lift (add) ¡: ¡ (Stream<Int>,Stream<Int>) ¡ Explicit -­‑> ¡Stream<Int> add ¡: ¡(Int,Int) ¡-­‑> ¡Int ¡ // ¡this ¡works ¡automatically! ¡ Implicit s3 ¡= ¡add(stream1,stream2) ¡ x ¡= ¡add( get (stream1), get (stream2)) Manual

  16. method overloading 3. Lifting (define add for Int and Stream) still counts as explicit lift (add) ¡: ¡ (Stream<Int>,Stream<Int>) ¡ Explicit -­‑> ¡Stream<Int> in dynamically typed languages add ¡: ¡(Int,Int) ¡-­‑> ¡Int ¡ // ¡this ¡works ¡automatically! ¡ Implicit s3 ¡= ¡add(stream1,stream2) ¡ x ¡= ¡add( get (stream1), get (stream2)) Manual

  17. Language Basic abstractions Evaluation Lifting Multidirectionality Glitch model avoidance FRP Siblings Fran behaviours and events Pull Explicit N Y Yampa signal functions and Pull Explicit N Y events FrTime behaviours and events Push Implicit N Y NewFran behaviours and events Push and Explicit N Y Pull Frapp´ e behaviours and events Push Explicit N N Scala.React signals and events Push Manual N Y Flapjax behaviours and events Push Explicit and N Y (local) implicit AmbientTalk/R behaviours and events Push Implicit N Y (local) Cousins of Reactive Programming Cells rules, cells and ob- Push Manual N Y servers Lamport Cells reactors and reporters Push and Manual N N Pull SuperGlue signals, components, Push Manual N Y and rules Trellis cells and rules Push Manual N Y* Radul/Sussman propagators and cells Push Manual Y N Propagators Coherence reactions and actions Pull N/A Y Y .NET Rx events Push Manual N N?

  18. Multidirectionality Glitch avoidance 4. Multidirectionality N Y N Y N Y • updates in both directions N Y N N F ¡= ¡(C ¡* ¡1.8) ¡+ ¡32 N Y and N Y N Y N Y N N N Y (scheme) N Y* Trellis Y N Radul/Sussman Propagators Y Y Coherence N N? .NET Rx

  19. Multidirectionality Glitch avoidance 4. Multidirectionality N Y N Y N Y • updates in both directions N Y N N F ¡= ¡(C ¡* ¡1.8) ¡+ ¡32 N Y and N Y N Y ºF ºC Convert N Y N N N Y (scheme) ºF ºC Convert N Y* Trellis Y N Radul/Sussman Propagators Y Y Coherence N N? .NET Rx

  20. 5. Glitches “Momentary view of inconsistent data” var1 = 1 var2 = var1 * 1 Change to “2” var3 = var1 + var2 1 var1 1 2 * + var2 var3 1

  21. 5. Glitches Change to “2” 2 1 var1 1 2 * + var2 var3 1 1st Calculate ‘+’ 2 1 var1 3 1 2 * + var2 var3 1

  22. 5. Glitches Change to “2” 2 1 var1 1 2 * + var2 var3 1 1st Calculate ‘+’ WRONG! 2nd Calculate * 2 1 var1 2 3 1 2 * + var2 var3 1

Recommend


More recommend