SlideShare a Scribd company logo
1 of 59
Download to read offline
Loosely-coupled Distributed Reactive
      Programming in Mobile Ad Hoc Networks
      Andoni Lombide Carreton, Stijn Mostinckx,
      Tom Van Cutsem and Wolfgang De Meuter




      Department of Computer Science
      Vrije Universiteit Brussel

      48th International Conference on Objects, Models, Components, Patterns -- TOOLS 2010
      June 28 - July 2 2010
      Malàga, Spain

Tuesday 29 June 2010
The mobile ticket trader application




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks




                                              Mobile devices




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

                                              Mobile devices




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

                                                   Mobile devices




                                        Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

                                                    Mobile devices




              Spontaneous interactions



                                         Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks
                       Scarce infrastructure
                                                          Mobile devices




              Spontaneous interactions



                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks
                       Scarce infrastructure
                                                          Mobile devices



 Representation of physical objects




              Spontaneous interactions



                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                 Mobile devices



      Spontaneous interactions




                                          Distributed
                                   Event-driven Architecture

          Scarce infrastructure


                                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                 Mobile devices



      Spontaneous interactions


                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

          Scarce infrastructure


                                                               Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                 Mobile devices



      Spontaneous interactions


                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

          Scarce infrastructure

                                      ecent ralized
                                    D                          Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                       Mobile devices



      Spontaneous interactions


                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

                                                      Res
                                                            ilien
          Scarce infrastructure                                  t
                                      ecent ralized
                                    D                                Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                         Mobile devices



      Spontaneous interactions
                                              Event streams

                                            overy
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

                                                        Res
                                                              ilien
          Scarce infrastructure                                    t
                                      ecent ralized
                                    D                                  Intermittent connectivity




Tuesday 29 June 2010
Pervasive Computing and Mobile Ad Hoc
      Networks

             Representation of physical objects
                                                                                   Mobile devices


                                              Event streams
      Spontaneous interactions
                                                                       as ting
                                                               ro adc
                                            overy             B
                                   o c Disc
                             Ad H         Distributed
                                   Event-driven Architecture

                                                        Res
                                                              ilien
          Scarce infrastructure                                    t
                                      ecent ralized
                                    D                                            Intermittent connectivity




Tuesday 29 June 2010
Distributed Event-driven Architecture

      • Spontaneous discovery of nearby peers
        and their ticket offers


      • Disconnection/reconnection


      • Location of interesting peers changed


      • Own location changed


      • Price of interesting ticket offers changed




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk
                       “do m immediately”



                             obj.m()

                       obj




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk
                              “do m eventually”



                           obj<-m()




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk
                              “do m eventually”



                           obj<-m()




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




                         ?
                       future




Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




                         ?
                       future




                         when: future becomes: { |value|
                           // process reply
                         }


Tuesday 29 June 2010
Event Loop Concurrency in AmbientTalk




                         ?
                       future




                         when: future becomes: { |value|
                           // process reply
                         }


Tuesday 29 June 2010
Publishing & discovering objects by topic


                                     ticketVendor




Tuesday 29 June 2010
Publishing & discovering objects by topic


                                      ticketVendor




              deftype TicketVendor   deftype TicketVendor




Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor




Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
    when: ticketVendor disconnected: {
       // React on disappearance
    }
    when: ticketVendor reconnected: {
       // React on reappearance
    }}
Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
    when: ticketVendor disconnected: {
       // React on disappearance
    }
    when: ticketVendor reconnected: {
       // React on reappearance
    }}
Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
                                                          covery
    when: ticketVendor disconnected: {
       // React on disappearance
                                              Ad H oc Dis
    }
    when: ticketVendor reconnected: {
       // React on reappearance
    }}
Tuesday 29 June 2010
Publishing & discovering objects by topic


                                               ticketVendor




              deftype TicketVendor            deftype TicketVendor
                                     export: ticketVendor as: TicketVendor
  whenever: TicketVendor discovered: { |ticketVendor|
    // React on ticketVendor appearance
                                                          covery
    when: ticketVendor disconnected: {
       // React on disappearance
                                              Ad H oc Dis
    }
    when: ticketVendor reconnected: {                      alized
       // React on reappearance                   D ecentr
    }}
Tuesday 29 June 2010
Asynchronous communication

                       getLocation



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication

                       getLocation



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication

                       getLocation



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Asynchronous communication



                                                   ticketVendor




                       Res
                          ilien
                               t
          when: TicketVendor discovered: { |ticketVendor|
            when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc|
              // Update user interface with the location
            } catch: TimeoutException using: { |e|
              // Remove ticket offer from user interface
            }
          }
Tuesday 29 June 2010
Ambient References




                                                                      ting
                       werchterVendors
                                                                   as
                                                             ro adc
                                                            B


             def werchterVendors := ambient: TicketVendor where: { |tv|
                tv.event == “Rock Werchter”
             };

             whenAll: werchterVendors<-getLocation()@Expires(5.seconds)
               becomes: { |locations|
                 // Update the map GUI with the locations
               }
Tuesday 29 June 2010
Ambient References




                                                                      ting
                       werchterVendors
                                                                   as
                                                             ro adc
                                                            B


             def werchterVendors := ambient: TicketVendor where: { |tv|
                tv.event == “Rock Werchter”
             };

             whenAll: werchterVendors<-getLocation()@Expires(5.seconds)
               becomes: { |locations|
                 // Update the map GUI with the locations
               }
Tuesday 29 June 2010
AmbientTalk/R
          gui.centerOn(GPS_Location.latitude, GPS_Location.longitude);


                                     GPS_Location




                        _.latitude                  _.longitude




                        latitude                    longitude




                               gui.centerOn(_, _)

Tuesday 29 June 2010
AmbientTalk/R
          gui.centerOn(GPS_Location.latitude, GPS_Location.longitude);


                                     GPS_Location




                        _.latitude                  _.longitude




                        latitude                    longitude




                               gui.centerOn(_, _)

Tuesday 29 June 2010
AmbientTalk/R
          gui.centerOn(GPS_Location.latitude, GPS_Location.longitude);


                                     GPS_Location




                        _.latitude                  _.longitude




                        latitude                    longitude




                               gui.centerOn(_, _)

Tuesday 29 June 2010
AmbientTalk/R
                       def Coordinate := isolate: {
                         def latitude := 0;
                         def longitude := 0;

                            def distanceTo(anotherCoordinate) {
                               // Compute via Haversine formula
                            };

                            def @Mutator update(newLatitude, newLongitude) {
                               latitude := newLatitude;
                               longitude := newLongitude;
                            };
                       };

                       def GPS_Location := makeReactive(Coordinate.new());

                       GPS.addLocationObserver: { |lat, lon|
                                                                   GPS_Location
                          GPS_Location.update(lat, lon)
                       };
Tuesday 29 June 2010
AmbientTalk/R
                       def Coordinate := isolate: {
                         def latitude := 0;
                         def longitude := 0;

                            def distanceTo(anotherCoordinate) {
                               // Compute via Haversine formula
                            };

                            def @Mutator update(newLatitude, newLongitude) {
                               latitude := newLatitude;
                               longitude := newLongitude;
                            };                                      Event streams
                       };

                       def GPS_Location := makeReactive(Coordinate.new());

                       GPS.addLocationObserver: { |lat, lon|
                                                                   GPS_Location
                          GPS_Location.update(lat, lon)
                       };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                               vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude




                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude
                                                                                         vendorLocation

                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };

                                                                      TicketVendorLocation

                                      GPS_Location




                         _.latitude                  _.longitude

                  GUI.showLocationOnM                                                  vendorLocation


                          latitude                   longitude
                                                                                         vendorLocation

                                      gui.centerOn
                                         (_, _)


                                                                   vendorLocation




                       def @Any vendorLocation := ambientBehavior: TicketVendorLocation
                         where: { def interestedIn := “Rock Werchter” };
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations



                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations

                        GPS_Location

                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations

                        GPS_Location

                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
      exportBehavior: GPS_Location as: TicketVendorLocation
        to: { |buyer| buyer.interestedIn == “Rock Werchter” };



                            GPS_Location




                                                             vendorLocations



                                                               vendorLocations




                       GPS_Location
                                           vendorLocations




                def @All vendorLocations := ambientBehavior: TicketVendorLocation
                  where: { def interestedIn := “Rock Werchter” } timeout: 2000;
Tuesday 29 June 2010
Ambient Behaviors
       def findOffers(event, maxPrice, maxDistance) {
         // Subscribe to ticket offers
         def @All allNearbyOffers := ambientBehavior: TicketOfferT timeout: 2000;

            // Filter out interesting ticket offers
            allNearbyOffers.filter: { |offer|
              (offer.eventName == event).and: {
               (offer.price <= maxPrice).and: {
                 GPS_Location.distanceTo(offer.location) <= maxDistance }}};
       };
                                               • Disconnection/reconnection


                                               • Location of interesting peers changed
def werchterVendors :=
  findOffers(“Rock Werchter”, 120, 500);
                                               • Own location changed
gui.updateWithOffers(werchterVendors);

                                               • Price of interesting ticket offers changed
Tuesday 29 June 2010
Reactive Queries




                        werchterVendors




     def werchterVendors := ambient: TicketVendor where: { |tv|
        tv.event == “Rock Werchter”
     };

     def locations := werchterVendors<-getLocation()@Refresh(2.seconds);

     locations.each:
       { |coordinates| GUI.showLocationOnMap(coordinates) };

Tuesday 29 June 2010
Reactive Queries




                        werchterVendors




     def werchterVendors := ambient: TicketVendor where: { |tv|
        tv.event == “Rock Werchter”
     };

     def locations := werchterVendors<-getLocation()@Refresh(2.seconds);

     locations.each:
       { |coordinates| GUI.showLocationOnMap(coordinates) };

Tuesday 29 June 2010
Limitations and Future Work

      • AmbientTalk/R yields a higher computational overhead than plain
        AmbientTalk.


      • Event message order preservation not guaranteed on very fine-grained levels
        over different communication partners.


      • No real-time guarantees.


      • Event consumers can only create and cancel their distributed dependencies:
        they cannot limit the number of propagated events.




Tuesday 29 June 2010
Conclusion

      • Decentralized publish/subscribe architecture based on UDP broadcasting
        allows spontaneous and loosely-coupled group interactions.


      • Reactive interpreter allows reacting to and processing of events without
        relying on “callback-spaghetti”.


      • Ambient behaviors and reactive queries reconcile both programming styles.


      • Event propagation happens with asynchronous messages among distributed
        event loops: no concurrency issues and resilient to intermittent network
        connectivity.




                http://soft.vub.ac.be/soft/research/amopcop
Tuesday 29 June 2010

More Related Content

What's hot

Sara de freitas the gamification of everyday life - seserv se workshop june...
Sara de freitas   the gamification of everyday life - seserv se workshop june...Sara de freitas   the gamification of everyday life - seserv se workshop june...
Sara de freitas the gamification of everyday life - seserv se workshop june...
ictseserv
 
SNViz: Analysis-oriented Visualization for the Internet of Things
SNViz: Analysis-oriented Visualization for the Internet of ThingsSNViz: Analysis-oriented Visualization for the Internet of Things
SNViz: Analysis-oriented Visualization for the Internet of Things
benaam
 
When where why cloud
When where why cloudWhen where why cloud
When where why cloud
sallysogeti
 

What's hot (20)

Towards the Integration of Spatiotemporal User-Generated Content and Sensor Data
Towards the Integration of Spatiotemporal User-Generated Content and Sensor DataTowards the Integration of Spatiotemporal User-Generated Content and Sensor Data
Towards the Integration of Spatiotemporal User-Generated Content and Sensor Data
 
Recasting The Net
Recasting The NetRecasting The Net
Recasting The Net
 
Presentatie The Internet of Things iBestuur Congres 2013 door Ben van Lier
Presentatie The Internet of Things   iBestuur Congres 2013 door Ben van LierPresentatie The Internet of Things   iBestuur Congres 2013 door Ben van Lier
Presentatie The Internet of Things iBestuur Congres 2013 door Ben van Lier
 
Sara de freitas the gamification of everyday life - seserv se workshop june...
Sara de freitas   the gamification of everyday life - seserv se workshop june...Sara de freitas   the gamification of everyday life - seserv se workshop june...
Sara de freitas the gamification of everyday life - seserv se workshop june...
 
Issues of Information Semantics and Granularity in Cross-Media Publishing
Issues of Information Semantics and Granularity in Cross-Media PublishingIssues of Information Semantics and Granularity in Cross-Media Publishing
Issues of Information Semantics and Granularity in Cross-Media Publishing
 
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
Internet of Information and Services (IoIS): A Conceptual Integrative Archite...
 
SNViz: Analysis-oriented Visualization for the Internet of Things
SNViz: Analysis-oriented Visualization for the Internet of ThingsSNViz: Analysis-oriented Visualization for the Internet of Things
SNViz: Analysis-oriented Visualization for the Internet of Things
 
Tangible media ppt
Tangible media pptTangible media ppt
Tangible media ppt
 
The interactive and multimedia library
The interactive and multimedia libraryThe interactive and multimedia library
The interactive and multimedia library
 
BEN Event - Guijarro
BEN Event - GuijarroBEN Event - Guijarro
BEN Event - Guijarro
 
Cyber Worlds 2011 submission
Cyber Worlds 2011 submission Cyber Worlds 2011 submission
Cyber Worlds 2011 submission
 
Tangible &amp; Embodied Interaction @RSE11
Tangible &amp; Embodied Interaction @RSE11Tangible &amp; Embodied Interaction @RSE11
Tangible &amp; Embodied Interaction @RSE11
 
Context Awareness in Mobile Computing
Context Awareness in Mobile ComputingContext Awareness in Mobile Computing
Context Awareness in Mobile Computing
 
Ws_INREDIS_Publicaciones_científicas_2009-2010
Ws_INREDIS_Publicaciones_científicas_2009-2010Ws_INREDIS_Publicaciones_científicas_2009-2010
Ws_INREDIS_Publicaciones_científicas_2009-2010
 
Future network architecture: requirements and challenges
Future network architecture: requirements and challengesFuture network architecture: requirements and challenges
Future network architecture: requirements and challenges
 
ISMAR09 Paper
ISMAR09 PaperISMAR09 Paper
ISMAR09 Paper
 
05 Living Labs and Smart Cities Alvaro Oliveira
05 Living Labs and Smart Cities Alvaro Oliveira05 Living Labs and Smart Cities Alvaro Oliveira
05 Living Labs and Smart Cities Alvaro Oliveira
 
Tangible User Interface Showcase
Tangible User Interface ShowcaseTangible User Interface Showcase
Tangible User Interface Showcase
 
Annotating Microblog Posts with Sensor Data for Emergency Reporting Applications
Annotating Microblog Posts with Sensor Data for Emergency Reporting ApplicationsAnnotating Microblog Posts with Sensor Data for Emergency Reporting Applications
Annotating Microblog Posts with Sensor Data for Emergency Reporting Applications
 
When where why cloud
When where why cloudWhen where why cloud
When where why cloud
 

Similar to Distributed Reactive Programming Tools2010

Piet Demeester - Future Internet
Piet Demeester - Future InternetPiet Demeester - Future Internet
Piet Demeester - Future Internet
imec.archive
 
Io t features_and_architecture_2009
Io t features_and_architecture_2009Io t features_and_architecture_2009
Io t features_and_architecture_2009
CATTID "Sapienza"
 
Flyer co summit 2012 smarcos flyer indra
Flyer co summit 2012 smarcos flyer indraFlyer co summit 2012 smarcos flyer indra
Flyer co summit 2012 smarcos flyer indra
Smarcos Eu
 
SMARCOS INDRA WP6 Poste Vehicles Domain Final
SMARCOS INDRA WP6 Poste Vehicles Domain FinalSMARCOS INDRA WP6 Poste Vehicles Domain Final
SMARCOS INDRA WP6 Poste Vehicles Domain Final
Smarcos Eu
 
ISA11 - Mike Kuniavsky - Designing Smart Things
ISA11 - Mike Kuniavsky - Designing Smart ThingsISA11 - Mike Kuniavsky - Designing Smart Things
ISA11 - Mike Kuniavsky - Designing Smart Things
Interaction South America
 
Cyber security assocham
Cyber security assochamCyber security assocham
Cyber security assocham
nmrdkoz
 

Similar to Distributed Reactive Programming Tools2010 (18)

Piet Demeester - Future Internet
Piet Demeester - Future InternetPiet Demeester - Future Internet
Piet Demeester - Future Internet
 
Io t features_and_architecture_2009
Io t features_and_architecture_2009Io t features_and_architecture_2009
Io t features_and_architecture_2009
 
Pervasive computing and its Security Issues
Pervasive computing and its Security IssuesPervasive computing and its Security Issues
Pervasive computing and its Security Issues
 
Ubiquitous Computing and Context-Aware Services
Ubiquitous Computing and Context-Aware ServicesUbiquitous Computing and Context-Aware Services
Ubiquitous Computing and Context-Aware Services
 
Ubiquitious Computing: UX When There is No UI
Ubiquitious Computing: UX When There is No UIUbiquitious Computing: UX When There is No UI
Ubiquitious Computing: UX When There is No UI
 
Flyer co summit 2012 smarcos flyer indra
Flyer co summit 2012 smarcos flyer indraFlyer co summit 2012 smarcos flyer indra
Flyer co summit 2012 smarcos flyer indra
 
SMARCOS INDRA WP6 Poste Vehicles Domain Final
SMARCOS INDRA WP6 Poste Vehicles Domain FinalSMARCOS INDRA WP6 Poste Vehicles Domain Final
SMARCOS INDRA WP6 Poste Vehicles Domain Final
 
ISA11 - Mike Kuniavsky - Designing Smart Things
ISA11 - Mike Kuniavsky - Designing Smart ThingsISA11 - Mike Kuniavsky - Designing Smart Things
ISA11 - Mike Kuniavsky - Designing Smart Things
 
Future Internet Enterprise Systems
Future Internet Enterprise Systems Future Internet Enterprise Systems
Future Internet Enterprise Systems
 
Future Internet: Visions, Requirements, Key Ingredients, and Ongoing Research
Future Internet: Visions, Requirements, Key Ingredients, and Ongoing ResearchFuture Internet: Visions, Requirements, Key Ingredients, and Ongoing Research
Future Internet: Visions, Requirements, Key Ingredients, and Ongoing Research
 
Research Talk at Bell Labs - IoT System Architecture and Interactions
Research Talk at Bell Labs - IoT System Architecture and InteractionsResearch Talk at Bell Labs - IoT System Architecture and Interactions
Research Talk at Bell Labs - IoT System Architecture and Interactions
 
Cyber security assocham
Cyber security assochamCyber security assocham
Cyber security assocham
 
Maya
MayaMaya
Maya
 
Rethinking Technology Edge - Valgeo 2011
Rethinking Technology Edge - Valgeo 2011Rethinking Technology Edge - Valgeo 2011
Rethinking Technology Edge - Valgeo 2011
 
Valgeo2011 rethinking tech edge
Valgeo2011 rethinking tech edgeValgeo2011 rethinking tech edge
Valgeo2011 rethinking tech edge
 
Iis Scenarios Revisited Curry Leuven0610
Iis Scenarios Revisited Curry Leuven0610Iis Scenarios Revisited Curry Leuven0610
Iis Scenarios Revisited Curry Leuven0610
 
On Future Research Areas for ICT-enabled Governance
On Future Research Areas for ICT-enabled GovernanceOn Future Research Areas for ICT-enabled Governance
On Future Research Areas for ICT-enabled Governance
 
Cassandra framework a service oriented distributed multimedia
Cassandra framework  a service oriented distributed multimediaCassandra framework  a service oriented distributed multimedia
Cassandra framework a service oriented distributed multimedia
 

Distributed Reactive Programming Tools2010

  • 1. Loosely-coupled Distributed Reactive Programming in Mobile Ad Hoc Networks Andoni Lombide Carreton, Stijn Mostinckx, Tom Van Cutsem and Wolfgang De Meuter Department of Computer Science Vrije Universiteit Brussel 48th International Conference on Objects, Models, Components, Patterns -- TOOLS 2010 June 28 - July 2 2010 Malàga, Spain Tuesday 29 June 2010
  • 2. The mobile ticket trader application Tuesday 29 June 2010
  • 3. Pervasive Computing and Mobile Ad Hoc Networks Tuesday 29 June 2010
  • 4. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Tuesday 29 June 2010
  • 5. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Tuesday 29 June 2010
  • 6. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Intermittent connectivity Tuesday 29 June 2010
  • 7. Pervasive Computing and Mobile Ad Hoc Networks Mobile devices Spontaneous interactions Intermittent connectivity Tuesday 29 June 2010
  • 8. Pervasive Computing and Mobile Ad Hoc Networks Scarce infrastructure Mobile devices Spontaneous interactions Intermittent connectivity Tuesday 29 June 2010
  • 9. Pervasive Computing and Mobile Ad Hoc Networks Scarce infrastructure Mobile devices Representation of physical objects Spontaneous interactions Intermittent connectivity Tuesday 29 June 2010
  • 10. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions Distributed Event-driven Architecture Scarce infrastructure Intermittent connectivity Tuesday 29 June 2010
  • 11. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions overy o c Disc Ad H Distributed Event-driven Architecture Scarce infrastructure Intermittent connectivity Tuesday 29 June 2010
  • 12. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions overy o c Disc Ad H Distributed Event-driven Architecture Scarce infrastructure ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 13. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions overy o c Disc Ad H Distributed Event-driven Architecture Res ilien Scarce infrastructure t ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 14. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Spontaneous interactions Event streams overy o c Disc Ad H Distributed Event-driven Architecture Res ilien Scarce infrastructure t ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 15. Pervasive Computing and Mobile Ad Hoc Networks Representation of physical objects Mobile devices Event streams Spontaneous interactions as ting ro adc overy B o c Disc Ad H Distributed Event-driven Architecture Res ilien Scarce infrastructure t ecent ralized D Intermittent connectivity Tuesday 29 June 2010
  • 16. Distributed Event-driven Architecture • Spontaneous discovery of nearby peers and their ticket offers • Disconnection/reconnection • Location of interesting peers changed • Own location changed • Price of interesting ticket offers changed Tuesday 29 June 2010
  • 17. Event Loop Concurrency in AmbientTalk Tuesday 29 June 2010
  • 18. Event Loop Concurrency in AmbientTalk “do m immediately” obj.m() obj Tuesday 29 June 2010
  • 19. Event Loop Concurrency in AmbientTalk “do m eventually” obj<-m() Tuesday 29 June 2010
  • 20. Event Loop Concurrency in AmbientTalk “do m eventually” obj<-m() Tuesday 29 June 2010
  • 21. Event Loop Concurrency in AmbientTalk ? future Tuesday 29 June 2010
  • 22. Event Loop Concurrency in AmbientTalk ? future when: future becomes: { |value| // process reply } Tuesday 29 June 2010
  • 23. Event Loop Concurrency in AmbientTalk ? future when: future becomes: { |value| // process reply } Tuesday 29 June 2010
  • 24. Publishing & discovering objects by topic ticketVendor Tuesday 29 June 2010
  • 25. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor Tuesday 29 June 2010
  • 26. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor Tuesday 29 June 2010
  • 27. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance when: ticketVendor disconnected: { // React on disappearance } when: ticketVendor reconnected: { // React on reappearance }} Tuesday 29 June 2010
  • 28. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance when: ticketVendor disconnected: { // React on disappearance } when: ticketVendor reconnected: { // React on reappearance }} Tuesday 29 June 2010
  • 29. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance covery when: ticketVendor disconnected: { // React on disappearance Ad H oc Dis } when: ticketVendor reconnected: { // React on reappearance }} Tuesday 29 June 2010
  • 30. Publishing & discovering objects by topic ticketVendor deftype TicketVendor deftype TicketVendor export: ticketVendor as: TicketVendor whenever: TicketVendor discovered: { |ticketVendor| // React on ticketVendor appearance covery when: ticketVendor disconnected: { // React on disappearance Ad H oc Dis } when: ticketVendor reconnected: { alized // React on reappearance D ecentr }} Tuesday 29 June 2010
  • 31. Asynchronous communication getLocation ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 32. Asynchronous communication getLocation ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 33. Asynchronous communication getLocation ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 34. Asynchronous communication ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 35. Asynchronous communication ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 36. Asynchronous communication ticketVendor when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 37. Asynchronous communication ticketVendor Res ilien t when: TicketVendor discovered: { |ticketVendor| when: ticketVendor<-getLocation()@Due(timeout) becomes: { |loc| // Update user interface with the location } catch: TimeoutException using: { |e| // Remove ticket offer from user interface } } Tuesday 29 June 2010
  • 38. Ambient References ting werchterVendors as ro adc B def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; whenAll: werchterVendors<-getLocation()@Expires(5.seconds) becomes: { |locations| // Update the map GUI with the locations } Tuesday 29 June 2010
  • 39. Ambient References ting werchterVendors as ro adc B def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; whenAll: werchterVendors<-getLocation()@Expires(5.seconds) becomes: { |locations| // Update the map GUI with the locations } Tuesday 29 June 2010
  • 40. AmbientTalk/R gui.centerOn(GPS_Location.latitude, GPS_Location.longitude); GPS_Location _.latitude _.longitude latitude longitude gui.centerOn(_, _) Tuesday 29 June 2010
  • 41. AmbientTalk/R gui.centerOn(GPS_Location.latitude, GPS_Location.longitude); GPS_Location _.latitude _.longitude latitude longitude gui.centerOn(_, _) Tuesday 29 June 2010
  • 42. AmbientTalk/R gui.centerOn(GPS_Location.latitude, GPS_Location.longitude); GPS_Location _.latitude _.longitude latitude longitude gui.centerOn(_, _) Tuesday 29 June 2010
  • 43. AmbientTalk/R def Coordinate := isolate: { def latitude := 0; def longitude := 0; def distanceTo(anotherCoordinate) { // Compute via Haversine formula }; def @Mutator update(newLatitude, newLongitude) { latitude := newLatitude; longitude := newLongitude; }; }; def GPS_Location := makeReactive(Coordinate.new()); GPS.addLocationObserver: { |lat, lon| GPS_Location GPS_Location.update(lat, lon) }; Tuesday 29 June 2010
  • 44. AmbientTalk/R def Coordinate := isolate: { def latitude := 0; def longitude := 0; def distanceTo(anotherCoordinate) { // Compute via Haversine formula }; def @Mutator update(newLatitude, newLongitude) { latitude := newLatitude; longitude := newLongitude; }; Event streams }; def GPS_Location := makeReactive(Coordinate.new()); GPS.addLocationObserver: { |lat, lon| GPS_Location GPS_Location.update(lat, lon) }; Tuesday 29 June 2010
  • 45. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 46. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 47. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 48. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 49. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude vendorLocation gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 50. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; TicketVendorLocation GPS_Location _.latitude _.longitude GUI.showLocationOnM vendorLocation latitude longitude vendorLocation gui.centerOn (_, _) vendorLocation def @Any vendorLocation := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” }; Tuesday 29 June 2010
  • 51. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 52. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations GPS_Location vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 53. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations GPS_Location vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 54. Ambient Behaviors exportBehavior: GPS_Location as: TicketVendorLocation to: { |buyer| buyer.interestedIn == “Rock Werchter” }; GPS_Location vendorLocations vendorLocations GPS_Location vendorLocations def @All vendorLocations := ambientBehavior: TicketVendorLocation where: { def interestedIn := “Rock Werchter” } timeout: 2000; Tuesday 29 June 2010
  • 55. Ambient Behaviors def findOffers(event, maxPrice, maxDistance) { // Subscribe to ticket offers def @All allNearbyOffers := ambientBehavior: TicketOfferT timeout: 2000; // Filter out interesting ticket offers allNearbyOffers.filter: { |offer| (offer.eventName == event).and: { (offer.price <= maxPrice).and: { GPS_Location.distanceTo(offer.location) <= maxDistance }}}; }; • Disconnection/reconnection • Location of interesting peers changed def werchterVendors := findOffers(“Rock Werchter”, 120, 500); • Own location changed gui.updateWithOffers(werchterVendors); • Price of interesting ticket offers changed Tuesday 29 June 2010
  • 56. Reactive Queries werchterVendors def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; def locations := werchterVendors<-getLocation()@Refresh(2.seconds); locations.each: { |coordinates| GUI.showLocationOnMap(coordinates) }; Tuesday 29 June 2010
  • 57. Reactive Queries werchterVendors def werchterVendors := ambient: TicketVendor where: { |tv| tv.event == “Rock Werchter” }; def locations := werchterVendors<-getLocation()@Refresh(2.seconds); locations.each: { |coordinates| GUI.showLocationOnMap(coordinates) }; Tuesday 29 June 2010
  • 58. Limitations and Future Work • AmbientTalk/R yields a higher computational overhead than plain AmbientTalk. • Event message order preservation not guaranteed on very fine-grained levels over different communication partners. • No real-time guarantees. • Event consumers can only create and cancel their distributed dependencies: they cannot limit the number of propagated events. Tuesday 29 June 2010
  • 59. Conclusion • Decentralized publish/subscribe architecture based on UDP broadcasting allows spontaneous and loosely-coupled group interactions. • Reactive interpreter allows reacting to and processing of events without relying on “callback-spaghetti”. • Ambient behaviors and reactive queries reconcile both programming styles. • Event propagation happens with asynchronous messages among distributed event loops: no concurrency issues and resilient to intermittent network connectivity. http://soft.vub.ac.be/soft/research/amopcop Tuesday 29 June 2010