Engineering large-scale Cyber-Physical Systems - like robot swarms, augmented crowds, and smart cities - is challenging, for many issues have to be addressed, including specifying their collective adaptive behaviour and managing the connection of the digital and physical parts. In particular, some approaches propose self-organising mechanisms to actually program global behaviour while fostering decentralised, asynchronous execution. However, most of these approaches couple behavioural specifications to specific network architectures (e.g., peer-to-peer), and therefore do not promote flexible exploitation of the underlying infrastructure. Conversely, pulverisation is a recent approach that enables self-organising behaviour to be defined independently of the available infrastructure while retaining functional correctness. However, there are currently no tools to formally specify and verify concrete architectures for pulverised applications. Therefore, we propose to combine pulverisation with multi-tier programming, a paradigm that supports the specification of the architecture of distributed systems in a single code base, and enables static checks for the correctness of actual deployments. The approach can be implemented by combining the ScaFi aggregate computing toolchain with the ScalaLoci multi-tier programming language, paving the path to support the development of self-organising cyber-physical systems, addressing both functional (behaviour) and non-functional concerns (deployment) in a single code base and modular fashion.

Full paper