AmbientTalk: Object-oriented Event-driven Programming in Mobile Ad hoc Networks Tom Van Cutsem, Stijn Mostinckx, Elisa Gonzalez Boix, Jessie Dedecker, Wolfgang De Meuter Programming Technology Lab Vrije Universiteit Brussel Brussels, Belgium tvcutsem|smostinc|egonzale|jededeck|wdmeuter@vub.ac.be Abstract—In this paper, we describe AmbientTalk: a domain- specific language for orchestrating service discovery and compo- sition in mobile ad hoc networks. AmbientTalk is a distributed object-oriented programming language whose actor-based, event- driven concurrency model makes it highly suitable for composing service objects across a mobile network. The language is a so-called ambient-oriented programming language which treats network partitions as a normal mode of operation. We describe AmbientTalk’s object model, concurrency model and distributed communication model in detail. We also highlight the major influences from other languages and middleware that have shaped AmbientTalk’s design. Index Terms—distributed languages, actors, events, pub- lish/subscribe, service discovery, service composition, mobile networks, pervasive computing I. I NTRODUCTION With the introduction of ever smaller, handheld computing devices over the past few decades, there has been a tremendous increase in research into mobile ad hoc networks. Such net- works are composed of mobile devices equipped with wireless communication technology and are often not administered. This hardware constellation is often claimed to serve as a fruitful basis for many pervasive and ubiquitous computing [1] scenarios [2]. The network’s wireless capabilities, combined with the mobility of the devices, results in applications where software entities spontaneously detect one another, engage in various collaborations, and may disappear as swiftly as they appeared. Although there has been a lot of active research with respect to mobile computing middleware [3], there has been little innovation in the field of programming language research to tackle the issues raised by mobile networks. Although dis- tributed programming languages are rare, they form a suitable development tool for encapsulating many of the complex issues engendered by distribution [4], [5]. The distributed programming languages developed to date have either been designed for high-performance computing (e.g. X10 [6]), for Draft version. Revised version accepted at the XXVI International Confer- ence of the Chilean Computer Science Society, SCCC 2007. Tom Van Cutsem is a Research Assistant of the Fund for Scientific Research, Flanders (F.W.O.). Stijn Mostinckx is funded by a doctoral schol- arship of the Institute for the Promotion of Innovation through Science and Technology in Flanders (IWT-Vlaanderen), Belgium. reliable distributed computing (e.g. Argus [7]) or for general- purpose distributed computing in fixed, stationary networks (e.g. Emerald [8], Obliq [9], E [10]). None of these languages have been explicitly designed for mobile networks. They lack the language support necessary to deal with the radically different network topology. In this paper, we introduce AmbientTalk, a distributed object-oriented programming language which has been de- signed for mobile ad hoc networks from the ground up. AmbientTalk is a small, dynamically typed object-oriented language. What makes the language suitable for composing services across a mobile network is its actor-based, event- driven concurrency model in combination with its built-in peer-to-peer, publish/subscribe service discovery abstractions. AmbientTalk has previously been described as an exemplar of the ambient-oriented programming (AmOP) paradigm [11]. We will revisit the key characteristics of the AmOP paradigm in section III. The language described in this paper is actually AmbientTalk/2, an updated version of the language as it is presented in [11]. However, we will simply refer to the updated language as AmbientTalk because it supplants its predecessor while staying true to its fundamental characteristics. The paper is structured according to three large parts. In sections II and III, we describe the salient features of mobile ad hoc networks in more detail, revisit the ambient-oriented programming paradigm and motivate the need for novel pro- gramming language support. Subsequently, in sections IV, V and VI we introduce the AmbientTalk language itself. We first describe its standard object-oriented features, then its concurrent and finally its distributed language features. The final part of the paper describes the advancements with respect to previous work and discusses related work in the field of programming languages and middleware which have influenced the design of the AmbientTalk language. II. MOBILE AD HOC NETWORKS There are two discriminating properties of mobile networks, which clearly set them apart from traditional, fixed computer networks: applications are deployed on mobile devices which are connected by wireless communication links with a limited communication range. Such networks exhibit two phenomena which are rare in their fixed counterparts: