Programming Urban-area Applications Dries Harnie dharnie@vub.ac.be Elisa Gonzalez Boix egonzale@vub.ac.be Theo D’Hondt tjdhondt@vub.ac.be Wolfgang De Meuter wdmeuter@vub.ac.be Software Languages Lab Vrije Universiteit Brussel ABSTRACT The evolution of smartphones has given rise to urban-area applications: applications that communicate in a city by means of the public (moving) infrastructure, e.g. buses and trams. In this setting, applications need to communicate and discover each other using intermediaries that move around the city and transfer data between them. This requires pro- grammers to scatter code that deals with routing messages to the correct place and dealing with network failures all over their programs. Our approach allows the programmer to specify urban-area applications in a high-level manner without the burden of directly encoding communication us- ing intermediaries. We present this as a translation from a high-level object-oriented programming paradigm to a low- level communication mechanism. Categories and Subject Descriptors C.2.4 [Computer-Communication Networks]: Distributed Systems Distributed Applications; D.3.3 [Software]: Lan- guage Constructs and Features Keywords Tuple spaces, ambient-oriented programming 1. INTRODUCTION There is no denying that smartphones have taken off in re- cent years, with significant improvements to both their com- putational and communication capacities. This has given rise to a huge ecosystem of mobile applications, varying from entertainment to information retrieval, on-line shopping and others. These applications typically adapt the functionality present in existing desktop or web applications to the user interface and capabilities of mobile devices. Some mobile applications are explicitly targeted towards people in a city: e.g. applications that alert the user to road works in the city or tourist guide applications. These applications are Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. SAC’12 March 25-29, 2012, Riva del Garda, Italy. Copyright 2012 ACM 978-1-4503-0857-1/12/03 ...$10.00. sometimes made available outside of traditional channels, for example the city of London offers tourist information applications in tourism offices spread throughout the city. Almost all mobile applications assume that internet con- nectivity is always available. This is not always the case though, e.g. a user might be in an area where his device does not get a signal. Additionally, a user might not want to use mobile data connections as they can be very expen- sive, especially when traveling abroad. In practice, smart- phone owners travel between“islands of connectivity”, like their home, their office and Wi-Fi access points provided by local businesses. When the user is not on an island of connectivity the mobile applications on their smartphone are incapable of communicating, often for hours at a time. When the device regains connectivity, programmers need to coordinate and reconcile any off-line operations with other devices. In this paper we propose to use the public transportation infrastruc- ture to carry user communication, extending the existing islands of connectivity to the areas frequented by the pub- lic transportation. We call this kind of applications that are distributed on and focused on a city urban-area applications. Rather than communicating through servers on the inter- net, urban-area applications communicate using this public transportation backbone. Unfortunately, current mobile middleware is not directly applicable for programming urban-area applications, as they work under different assumptions. First of all, applications primarily communicate with other applications indirectly. They will send a message using the public transportation backbone and eventually get an answer back. With round- trip communication times of several minutes, programmers must write applications that communicate asynchronously. Because communication happens via third parties, some mes- sages will arrive in duplicate or not at all; developers must take care their applications still work as intended. Finally, there is no central registry of applications; instead, applica- tions must discover other running applications in order to interact with them. In this paper, we explore a means of programming urban- area applications that extends the popular object-oriented programming paradigm, while hiding the communication and distribution details from the programmer. This makes it possible to formulate urban-area applications using high- level communication abstractions. Our approach then trans- lates these abstractions into low-level communication that uses store-and-forward communication strategies. The rest of this paper is structured as follows: first we de-