SlideShare a Scribd company logo
Towards Aggregate Programming in Scala
Roberto Casadei Mirko Viroli
Department of Computer Science and Engineering
University of Bologna
1st International Workshop on Programming Models and Languages for
Distributed Computing (PMLDC), 2016, Rome
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 1 / 46
Outline
1 Context and Issues
2 Aggregate Computing
3 Aggregate Programming in Scala
4 Summary
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 2 / 46
Context and Issues
Outline
1 Context and Issues
2 Aggregate Computing
3 Aggregate Programming in Scala
4 Summary
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 3 / 46
Context and Issues
Context
Environment + (Mobile, Large-scale) Networks of { people + devices }
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 4 / 46
Context and Issues
The systems of (((((((
tomorrow today...
Complex/Collective Adaptive Systems (CASs)
• Socio-Technical Systems (STS)
• Internet of Things (IoT)
• Pervasive systems
• Ubiquitous systems
• Cyber-Physical Systems (CPS)
• Smart-cities/buildings/homes, ...
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 5 / 46
Context and Issues
Ecosystems of CASs services
The crowd engineering example
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 6 / 46
Context and Issues
Gathering local context
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 7 / 46
Context and Issues
Sensing global patterns of data
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 8 / 46
Context and Issues
Crowd detection
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 9 / 46
Context and Issues
Crowd anticipation
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 10 / 46
Context and Issues
Crowd-aware steering
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 11 / 46
Context and Issues
Crowd dispersal
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 12 / 46
Context and Issues
Crowd evacuation upon alerts
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 13 / 46
Context and Issues
What? How?
The problem
• Large-scale
• Complex dynamics
• Substantial unpredictability
Approach
• Decentralisation
• Adaptation
• To occasional disruptions
• To on-going perturbation
• To device distribution
• To available infrastructure
Design issues
• Abstraction gap — i.e., the distance from the problem to the solution
• Capturing complex behaviours in a simple way
• Supporting modularity and reusability
• Guiding engineering for resilience
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 14 / 46
Context and Issues
What? How?
The problem
• Large-scale
• Complex dynamics
• Substantial unpredictability
Approach
• Decentralisation
• Adaptation
• To occasional disruptions
• To on-going perturbation
• To device distribution
• To available infrastructure
Design issues
• Abstraction gap — i.e., the distance from the problem to the solution
• Capturing complex behaviours in a simple way
• Supporting modularity and reusability
• Guiding engineering for resilience
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 14 / 46
Context and Issues
What? How?
The problem
• Large-scale
• Complex dynamics
• Substantial unpredictability
Approach
• Decentralisation
• Adaptation
• To occasional disruptions
• To on-going perturbation
• To device distribution
• To available infrastructure
Design issues
• Abstraction gap — i.e., the distance from the problem to the solution
• Capturing complex behaviours in a simple way
• Supporting modularity and reusability
• Guiding engineering for resilience
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 14 / 46
Aggregate Computing
Outline
1 Context and Issues
2 Aggregate Computing
3 Aggregate Programming in Scala
4 Summary
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 15 / 46
Aggregate Computing
The origins: self-organisation patterns [FMSM+
13]
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 16 / 46
Aggregate Computing
The origins: space-time programming [BV15]
Space-oriented computation – Thematic areas
(a) Intensive computing
(b) Computation embedded in space
(c) Space computation
Decentralised spatial computing
Computing “somewhere” [Duc13]
• Location-related information
• Spatial constraints to communication
Space-time programming [BV15]
• Computation expressed in terms of properties of the physical time and
space in which it occurs
• Spatial abstractions
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 17 / 46
Aggregate Computing
Discrete system vs. continuous space-time
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 18 / 46
Aggregate Computing
Computational fields
• (Abstract interpretation) Mapping space-time to computational objects
• (Concrete interpretation) Mapping devices to values: φ : δ →
• “Distributed” data structure working as the global abstraction
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 19 / 46
Aggregate Computing
The Computational Field Calculus I
Field calculus
A calculus of computational fields [DVB16]
• Functional
• Basis set of operators for field manipulation
• Minimal expressive model
≈ Space-time universal
Higher-Order Field Calculus (HOFC) [DVPB15]
• First-class distributed functions
• Code mobility
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 20 / 46
Aggregate Computing
The Computational Field Calculus II
Syntax
e = x | v | eλ(e) | rep(e0){eλ} | nbr{e } Expression
v = <standard-values> | λ Value
λ = f | o | (x) ⇒ e Functional value
F = def f(x){e } Function definition
• v includes numbers, booleans, strings, collections, custom ADTs, etc.
• f is a user-defined function
• o is a built-in functional operator (e.g., pure math or a sensor)
A sort of λ-calculus where values are computational fields, plus
(i) a construct for field evolution (rep)
(ii) a construct for interacting with the neighbourhood (nbr)
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 21 / 46
Aggregate Computing
The Computational Field Calculus III
Global-level semantics, intuitively
0
(x)=>x+1
true t<0,1>
()0
1
+
-
1
-1
ef(0,1)
ef
rep
0
(x)=>x+1
t
v0
t
v1
..
rep(0){(x)=>x+1}
nbr de
nbr{e}
φd=[d1→v1,..,dn→vn]
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 22 / 46
Aggregate Computing
Example: the channel I
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 23 / 46
Aggregate Computing
Example: the channel II
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 24 / 46
Aggregate Computing
Aggregate functions [DVPB15]
Left: branch(c){ f(x) }{ g(x) } Right: (branch(c){ f }{ g })(x)
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 25 / 46
Aggregate Computing
Aggregate programming [BPV15]
Programming (collective adaptive) systems: viewpoints
(a) Local viewpoint (device-centric view)
(b) Global viewpoint (aggregate view)
Aggregate programming: what
Goal: programming the collective behaviour of aggregates
Global-to-local mapping
Aggregate programming: how
Prominent approach founded on field calculus and self-org patterns
Composable self-organisation
• Self-stabilisation
• Building blocks for resilient coordination
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 26 / 46
Aggregate Computing
Device-centric programming
Issues
• Local-to-global mapping problem (generally intractable)
• Explicit design of adaptation and communication
• Mixing of concerns — state management, interaction, adaptation, resiliency, etc.
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 27 / 46
Aggregate Computing
Device-centric programming
Issues
• Local-to-global mapping problem (generally intractable)
• Explicit design of adaptation and communication
• Mixing of concerns — state management, interaction, adaptation, resiliency, etc.
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 27 / 46
Aggregate Computing
Aggregate-level programming
Collective services on the computational fabric available in space
• Automatic global-to-local mapping
• Implicit adaptation and communication
• Composition of loosely coupled services
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 28 / 46
Aggregate Computing
Aggregate-level programming
Collective services on the computational fabric available in space
• Automatic global-to-local mapping
• Implicit adaptation and communication
• Composition of loosely coupled services
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 28 / 46
Aggregate Computing
Aggregate (computing) systems
Structure
A set of networked devices
• Each one is given the same field calculus program
Dynamics
Each device computes the given program at asyn / partially-sync rounds of
execution
(1) Retrieve context
⇐ Messages from neighbours
⇐ Sensor values
(2) Aggregate program execution
⇒ export
(3) Broadcast export to neighbourhood
(4) Execute actuators
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 29 / 46
Aggregate Computing
Aggregate computing and abstraction
(Partial) insensitiveness to system structure and situation details
Aggregate behaviours are highly insensitive to:
• network size
• network density
• network topology
This makes algorithms intrinsically robust to failures and changes to working
conditions.
(Partial) insensitiveness to execution strategy
Note: network nodes ultimately correspond to components operating in some
context via sensors/actuators.
Aggregate computations can be carried out in different ways:
• Computing nodes and “native” local communication;
• Computations performed by a central server;
• Computations performed in the cloud; ...
Idea: opportunistically exploit the underlying infrastructure
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 30 / 46
Aggregate Computing
Aggregate Programming Stack
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 31 / 46
Aggregate Computing
Approaching the engineering of CASs
Approaching the aforementioned issues
• Abstraction gap — i.e., the distance from the problem to the solution
=⇒ Abstractions close to problem domain
=⇒ Declarative approach – from how to what
=⇒ Layered approach – raising abstraction incrementally
• Capturing complex behaviours in a simple way
=⇒ Instrumental assumptions + effective building blocks
=⇒ Balance of top-down and bottom-up problem solving
• Supporting modularity and reusability
=⇒ Compositional approach
• Guiding engineering for resilience
=⇒ Adaptation by construction
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
Aggregate Computing
Approaching the engineering of CASs
Approaching the aforementioned issues
• Abstraction gap — i.e., the distance from the problem to the solution
=⇒ Abstractions close to problem domain
=⇒ Declarative approach – from how to what
=⇒ Layered approach – raising abstraction incrementally
• Capturing complex behaviours in a simple way
=⇒ Instrumental assumptions + effective building blocks
=⇒ Balance of top-down and bottom-up problem solving
• Supporting modularity and reusability
=⇒ Compositional approach
• Guiding engineering for resilience
=⇒ Adaptation by construction
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
Aggregate Computing
Approaching the engineering of CASs
Approaching the aforementioned issues
• Abstraction gap — i.e., the distance from the problem to the solution
=⇒ Abstractions close to problem domain
=⇒ Declarative approach – from how to what
=⇒ Layered approach – raising abstraction incrementally
• Capturing complex behaviours in a simple way
=⇒ Instrumental assumptions + effective building blocks
=⇒ Balance of top-down and bottom-up problem solving
• Supporting modularity and reusability
=⇒ Compositional approach
• Guiding engineering for resilience
=⇒ Adaptation by construction
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
Aggregate Computing
Approaching the engineering of CASs
Approaching the aforementioned issues
• Abstraction gap — i.e., the distance from the problem to the solution
=⇒ Abstractions close to problem domain
=⇒ Declarative approach – from how to what
=⇒ Layered approach – raising abstraction incrementally
• Capturing complex behaviours in a simple way
=⇒ Instrumental assumptions + effective building blocks
=⇒ Balance of top-down and bottom-up problem solving
• Supporting modularity and reusability
=⇒ Compositional approach
• Guiding engineering for resilience
=⇒ Adaptation by construction
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
Aggregate Computing
Approaching the engineering of CASs
Approaching the aforementioned issues
• Abstraction gap — i.e., the distance from the problem to the solution
=⇒ Abstractions close to problem domain
=⇒ Declarative approach – from how to what
=⇒ Layered approach – raising abstraction incrementally
• Capturing complex behaviours in a simple way
=⇒ Instrumental assumptions + effective building blocks
=⇒ Balance of top-down and bottom-up problem solving
• Supporting modularity and reusability
=⇒ Compositional approach
• Guiding engineering for resilience
=⇒ Adaptation by construction
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
Aggregate Computing
Aggregate Programming Toolchain
Up to a few months ago..
Protelis [PVB15] + Alchemist simulator [PMV13]
• External DSL
• Focus on simulation
Technological gap: there is no aggregate programming framework, aimed at the
construction of real-world applications, integrated in a ≈mainstream language
⇒ SCAFI (scala with computational fields)
• Scala-internal DSL for expressing aggregate computations
• Distributed platform for execution of aggregate systems
SCAFI: where?
http://scafi.apice.unibo.it
• A more serious release soon :)
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 33 / 46
Aggregate Programming in Scala
Outline
1 Context and Issues
2 Aggregate Computing
3 Aggregate Programming in Scala
4 Summary
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 34 / 46
Aggregate Programming in Scala
SCAFI: Scala with Computational Fields
Goal
The goal is to provide an integrated framework for building systems with aggregate
programming
• Scala-internal DSL for expressing aggregate computations
• Linguistic support + execution support (interpreter/VM)
• Correct, complete, efficient implementation of the HOFC semantics
• Distributed platform for execution of aggregate systems
• Support for multiple architectural styles and system configurations
• Support for code mobility
Issues
• Implementation of a language for the field calculus within Scala
• Constructs as method calls
• Integration with the Scala type system
• Development of a distributed middleware
• Typical issues from distribution (concurrency, communication, fault-tolerance)
⇒ Akka actor framework
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 35 / 46
Aggregate Programming in Scala
SCAFI: language
trait Constructs {
def rep[A](init: A)
(fun: (A) => A): A
def nbr[A](expr: => A): A
def foldhood[A](init: => A)
(acc: (A,A)=>A)
(expr: => A): A
def branch[A](cond: => Boolean)
(th: => A)
(el: => A): A
def aggregate[A](f: => A): A
def sense[A](name: LSNS): A
def nbrvar[A](name: NSNS): A
}
Where are computational fields?
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 36 / 46
Aggregate Programming in Scala
Example: the channel I
def channel(src: Boolean, dest: Boolean, width: Double) =
distanceTo(src) + distanceTo(dest) <=
distBetween(src, dest) + width
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 37 / 46
Aggregate Programming in Scala
Example: the channel (full code)
def channel(src: Boolean, dest: Boolean, width: Double) =
distanceTo(src) + distanceTo(dest) <=
distBetween(src, dest) + width
def nbrRange(): Double = nbrvar[Double](NBR_RANGE_NAME)
def G[V:OB](src: Boolean, field: V, acc: V=>V, metric: =>Double): V =
rep( (Double.MaxValue, field) ){ dv =>
mux(src) { (0.0, field) } {
minHoodMinus {
val (d, v) = nbr { (dv._1, dv._2) }
(d + metric, acc(v))
}
}
}._2
def broadcast[V:OB](source: Boolean, field: V): V =
G[V](source, field, x=>x, nbrRange())
def distanceTo(source: Boolean): Double =
G[Double](source, 0, _ + nbrRange(), nbrRange())
def distBetween(source: Boolean, target: Boolean): Double =
broadcast(source, distanceTo(target))
def isSource = sense[Boolean]("source")
def isObstacle = sense[Boolean]("obstacle")
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 38 / 46
Aggregate Programming in Scala
P2p, ad-hoc net
// STEP 1: CHOOSE INCARNATION
import it.unibo.scafi.incarnations.{ BasicActorP2P => Platform }
// STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA
class Demo0C_AggregateProgram extends Platform.AggregateProgram {
override def main(): Any = foldhood(0){_ + _}(1)
}
// STEP 3: DEFINE MAIN PROGRAM
object Demo0C_MainProgram extends Platform.CmdLineMain
1) Demo_MainProgram -h 127.0.0.1 -p 9000
-e 1:2,4,5;2;3 --subsystems
127.0.0.1:9500:4:5
--program "demos.Demo_AggregateProgram"
2) Demo_MainProgram -h 127.0.0.1 -p 9500
-e 4;5:4
--program "demos.Demo_AggregateProgram"
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 39 / 46
Aggregate Programming in Scala
Server-based, mobile spatial net I
import it.unibo.scafi.distrib.actor.server.{SpatialPlatform =>
SpatialServerBasedActorPlatform}
import it.unibo.scafi.incarnations.BasicAbstractActorIncarnation
import it.unibo.scafi.space.{Point2D, BasicSpatialAbstraction}
object Demo3_Platform extends BasicAbstractActorIncarnation
with SpatialServerBasedActorPlatform
with BasicSpatialAbstraction with Serializable {
override val LocationSensorName: String = "LOCATION_SENSOR"
override type P = Point2D
override def buildNewSpace[E](elems: Iterable[(E,P)]): SPACE[E] =
new Basic3DSpace(elems.toMap) { override val proximityThreshold = 1.1 }
}
// STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA
class Demo3_AggregateProgram extends Demo3_Platform.AggregateProgram {
def hopGradient(source: Boolean): Double = {
rep(Double.PositiveInfinity){
hops => { mux(source) { 0.0 } { 1+minHood(nbr{ hops }) } }
}
}
def main() = hopGradient(sense("source"))
}
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 40 / 46
Aggregate Programming in Scala
Server-based, mobile spatial net II
// STEP 3: DEFINE MAIN PROGRAMS
object Demo3_ServerMain extends Demo3_Platform.ServerCmdLineMain {
override def refineSettings(s: Demo3_Platform.Settings) = {
s.copy(profile = s.profile.copy(
serverGuiActorProps = tm => Some(ServerGUIActor.props(Demo3_Platform, tm
))
))
}
}
object Demo4_MainProgram extends Demo3_Platform.CmdLineMain {
override def refineSettings(s: Demo3_Platform.Settings) = {
s.copy(profile = s.profile.copy(
devGuiActorProps = ref => Some(DevGUIActor.props(Demo3_Platform, ref))
))
}
override def onDeviceStarted(dm: Demo3_Platform.DeviceManager,
sys: Demo3_Platform.SystemFacade) = {
dm.addSensorValue(Demo3_Platform.LocationSensorName, Point2D(dm.selfId%5,(
dm.selfId/5.0).floor))
dm.addSensorValue("source", dm.selfId==4)
dm.start
}
}
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 41 / 46
Aggregate Programming in Scala
Server-based, mobile spatial net III
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 42 / 46
Summary
Outline
1 Context and Issues
2 Aggregate Computing
3 Aggregate Programming in Scala
4 Summary
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 43 / 46
Summary
Summary: key ideas and future directions
Aggregate programming
• An (((((((
programmingengineering approach to CASs
• Formally grounded in the Field Calculus
• Allows to compose “emergent” phenomena
• Provides layers of building blocks (proven to self-stabilise!)
A Scala framework for aggregate programming is out!
• Supports the construction of aggregate systems
• Integrated in Scala
No need to learn ad-hoc external DSLs
Easier to get started and play
• Better release (e.g., to Maven Central) soon, I promise :)
Many open problems [VB] (want to join?)
• Space-time universality
• Fields vs. objects/agents/processes/worflows
• Better resilience properties than self-stabilisation
• Adapting the execution strategy to available infrastructure (e.g., cloud, fog, ...)
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 44 / 46
Appendix References
References I
[BPV15] Jacob Beal, Danilo Pianini, and Mirko Viroli.
Aggregate Programming for the Internet of Things.
IEEE Computer, 2015.
[BV15] Jacob Beal and Mirko Viroli.
Space–time programming.
Phil. Trans. R. Soc. A, 373(2046):20140220, 2015.
[Duc13] Matt Duckham.
Decentralized Spatial Computing - Foundations of Geosensor Networks.
Springer, 2013.
[DVB16] Ferruccio Damiani, Mirko Viroli, and Jacob Beal.
A type-sound calculus of computational fields.
Science of Computer Programming, 117:17 – 44, 2016.
[DVPB15] Ferruccio Damiani, Mirko Viroli, Danilo Pianini, and Jacob Beal.
Code mobility meets self-organisation: A higher-order calculus of
computational fields.
volume 9039 of Lecture Notes in Computer Science, pages 113–128.
Springer International Publishing, 2015.
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 45 / 46
Appendix References
References II
[FMSM+
13] Jose Luis Fernandez-Marquez, Giovanna Di Marzo Serugendo, Sara
Montagna, Mirko Viroli, and Josep Lluís Arcos.
Description and composition of bio-inspired design patterns: a complete
overview.
Natural Computing, 12(1):43–67, 2013.
[PMV13] Danilo Pianini, Sara Montagna, and Mirko Viroli.
Chemical-oriented simulation of computational systems with alchemist.
Journal of Simulation, 7(3):202–215, 2013.
[PVB15] Danilo Pianini, Mirko Viroli, and Jacob Beal.
Protelis: practical aggregate programming.
In Proceedings of the 30th Annual ACM Symposium on Applied
Computing, pages 1846–1853. ACM, 2015.
[VB] Mirko Viroli and Jacob Beal.
Resiliency with Aggregate Computing : State of the Art and Roadmap.
R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 46 / 46

More Related Content

Viewers also liked

How To Use Higher Order Functions in Scala
How To Use Higher Order Functions in ScalaHow To Use Higher Order Functions in Scala
How To Use Higher Order Functions in Scala
BoldRadius Solutions
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
Calvin Cheng
 
Introduction to parallel and distributed computation with spark
Introduction to parallel and distributed computation with sparkIntroduction to parallel and distributed computation with spark
Introduction to parallel and distributed computation with spark
Angelo Leto
 
Scala meetup - Intro to spark
Scala meetup - Intro to sparkScala meetup - Intro to spark
Scala meetup - Intro to spark
Javier Arrieta
 
Apache Spark RDDs
Apache Spark RDDsApache Spark RDDs
Apache Spark RDDs
Dean Chen
 

Viewers also liked (6)

How To Use Higher Order Functions in Scala
How To Use Higher Order Functions in ScalaHow To Use Higher Order Functions in Scala
How To Use Higher Order Functions in Scala
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
 
Introduction to parallel and distributed computation with spark
Introduction to parallel and distributed computation with sparkIntroduction to parallel and distributed computation with spark
Introduction to parallel and distributed computation with spark
 
ScalaTrainings
ScalaTrainingsScalaTrainings
ScalaTrainings
 
Scala meetup - Intro to spark
Scala meetup - Intro to sparkScala meetup - Intro to spark
Scala meetup - Intro to spark
 
Apache Spark RDDs
Apache Spark RDDsApache Spark RDDs
Apache Spark RDDs
 

Similar to Towards Aggregate Programming in Scala

On Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate ComputingOn Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate Computing
Roberto Casadei
 
Compositional Blocks for Optimal Self-Healing Gradients
Compositional Blocks for Optimal Self-Healing GradientsCompositional Blocks for Optimal Self-Healing Gradients
Compositional Blocks for Optimal Self-Healing Gradients
Roberto Casadei
 
Aggregate Computing Research: an Overview
Aggregate Computing Research: an OverviewAggregate Computing Research: an Overview
Aggregate Computing Research: an Overview
Roberto Casadei
 
Programming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsProgramming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive Systems
Roberto Casadei
 
Practical Aggregate Programming in Scala
Practical Aggregate Programming in ScalaPractical Aggregate Programming in Scala
Practical Aggregate Programming in Scala
Roberto Casadei
 
A Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive EcosystemsA Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive Ecosystems
Roberto Casadei
 
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Roberto Casadei
 
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Roberto Casadei
 
Aggregate Processes in Field Calculus
Aggregate Processes in Field CalculusAggregate Processes in Field Calculus
Aggregate Processes in Field Calculus
Roberto Casadei
 
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Roberto Casadei
 
A Presentation of My Research Activity
A Presentation of My Research ActivityA Presentation of My Research Activity
A Presentation of My Research Activity
Roberto Casadei
 
The Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing SystemsThe Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing Systems
Neo4j
 
Collective Abstractions and Platforms for Large-Scale Self-Adaptive IoT
Collective Abstractions and Platforms for Large-Scale Self-Adaptive IoTCollective Abstractions and Platforms for Large-Scale Self-Adaptive IoT
Collective Abstractions and Platforms for Large-Scale Self-Adaptive IoT
Roberto Casadei
 
eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...
eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...
eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...
Gianluca Aguzzi
 
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Roberto Casadei
 
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Roberto Casadei
 
Scafi: Scala with Computational Fields
Scafi: Scala with Computational FieldsScafi: Scala with Computational Fields
Scafi: Scala with Computational Fields
Roberto Casadei
 
ScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based CoordinationScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based Coordination
Gianluca Aguzzi
 
Reifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specificationsReifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specifications
Benoit Combemale
 
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Roberto Casadei
 

Similar to Towards Aggregate Programming in Scala (20)

On Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate ComputingOn Execution Platforms for Large-Scale Aggregate Computing
On Execution Platforms for Large-Scale Aggregate Computing
 
Compositional Blocks for Optimal Self-Healing Gradients
Compositional Blocks for Optimal Self-Healing GradientsCompositional Blocks for Optimal Self-Healing Gradients
Compositional Blocks for Optimal Self-Healing Gradients
 
Aggregate Computing Research: an Overview
Aggregate Computing Research: an OverviewAggregate Computing Research: an Overview
Aggregate Computing Research: an Overview
 
Programming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsProgramming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive Systems
 
Practical Aggregate Programming in Scala
Practical Aggregate Programming in ScalaPractical Aggregate Programming in Scala
Practical Aggregate Programming in Scala
 
A Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive EcosystemsA Programming Framework for Collective Adaptive Ecosystems
A Programming Framework for Collective Adaptive Ecosystems
 
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
Towards Automated Engineering for Collective Adaptive Systems: Vision and Res...
 
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
Programming (and Learning) Self-Adaptive & Self-Organising Behaviour with Sca...
 
Aggregate Processes in Field Calculus
Aggregate Processes in Field CalculusAggregate Processes in Field Calculus
Aggregate Processes in Field Calculus
 
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
Collective Adaptive Systems as Coordination Media: The Case of Tuples in Spac...
 
A Presentation of My Research Activity
A Presentation of My Research ActivityA Presentation of My Research Activity
A Presentation of My Research Activity
 
The Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing SystemsThe Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing Systems
 
Collective Abstractions and Platforms for Large-Scale Self-Adaptive IoT
Collective Abstractions and Platforms for Large-Scale Self-Adaptive IoTCollective Abstractions and Platforms for Large-Scale Self-Adaptive IoT
Collective Abstractions and Platforms for Large-Scale Self-Adaptive IoT
 
eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...
eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...
eCAS 2021: Towards Pulverised Architectures for Collective Adaptive Systems t...
 
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
Digital Twins, Virtual Devices, and Augmentations for Self-Organising Cyber-P...
 
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
Self-Organisation Programming: a Functional Reactive Macro Approach (FRASP) [...
 
Scafi: Scala with Computational Fields
Scafi: Scala with Computational FieldsScafi: Scala with Computational Fields
Scafi: Scala with Computational Fields
 
ScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based CoordinationScaFi-Web, A Web-Based application for Field-based Coordination
ScaFi-Web, A Web-Based application for Field-based Coordination
 
Reifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specificationsReifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specifications
 
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
Programming Distributed Collective Processes for Dynamic Ensembles and Collec...
 

More from Roberto Casadei

Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligenceIntroduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Roberto Casadei
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
Roberto Casadei
 
6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems
Roberto Casadei
 
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical SystemsAugmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Roberto Casadei
 
Tuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated SystemsTuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated Systems
Roberto Casadei
 
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Roberto Casadei
 
Testing: an Introduction and Panorama
Testing: an Introduction and PanoramaTesting: an Introduction and Panorama
Testing: an Introduction and Panorama
Roberto Casadei
 
On Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingOn Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate Programming
Roberto Casadei
 
Engineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoTEngineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoT
Roberto Casadei
 
AWS and Serverless Computing
AWS and Serverless ComputingAWS and Serverless Computing
AWS and Serverless Computing
Roberto Casadei
 
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Roberto Casadei
 
The Rust Programming Language: an Overview
The Rust Programming Language: an OverviewThe Rust Programming Language: an Overview
The Rust Programming Language: an Overview
Roberto Casadei
 
Akka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an IntroductionAkka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an Introduction
Roberto Casadei
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
Roberto Casadei
 
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate PerspectiveBridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Roberto Casadei
 
From Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate ComputingFrom Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate Computing
Roberto Casadei
 
NodeJS: an Introduction
NodeJS: an IntroductionNodeJS: an Introduction
NodeJS: an Introduction
Roberto Casadei
 
Spring Boot: a Quick Introduction
Spring Boot: a Quick IntroductionSpring Boot: a Quick Introduction
Spring Boot: a Quick Introduction
Roberto Casadei
 
Introduction to cloud-native application development: with Heroku and Spring ...
Introduction to cloud-native application development: with Heroku and Spring ...Introduction to cloud-native application development: with Heroku and Spring ...
Introduction to cloud-native application development: with Heroku and Spring ...
Roberto Casadei
 

More from Roberto Casadei (19)

Introduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligenceIntroduction to the 1st DISCOLI workshop on distributed collective intelligence
Introduction to the 1st DISCOLI workshop on distributed collective intelligence
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
 
6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems6th eCAS workshop on Engineering Collective Adaptive Systems
6th eCAS workshop on Engineering Collective Adaptive Systems
 
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical SystemsAugmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
Augmented Collective Digital Twins for Self-Organising Cyber-Physical Systems
 
Tuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated SystemsTuple-Based Coordination in Large-Scale Situated Systems
Tuple-Based Coordination in Large-Scale Situated Systems
 
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
Pulverisation in Cyber-Physical Systems: Engineering the Self-Organising Logi...
 
Testing: an Introduction and Panorama
Testing: an Introduction and PanoramaTesting: an Introduction and Panorama
Testing: an Introduction and Panorama
 
On Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate ProgrammingOn Context-Orientation in Aggregate Programming
On Context-Orientation in Aggregate Programming
 
Engineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoTEngineering Resilient Collaborative Edge-enabled IoT
Engineering Resilient Collaborative Edge-enabled IoT
 
AWS and Serverless Computing
AWS and Serverless ComputingAWS and Serverless Computing
AWS and Serverless Computing
 
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
Coordinating Computation at the Edge: a Decentralized, Self-organizing, Spati...
 
The Rust Programming Language: an Overview
The Rust Programming Language: an OverviewThe Rust Programming Language: an Overview
The Rust Programming Language: an Overview
 
Akka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an IntroductionAkka Remoting and Clustering: an Introduction
Akka Remoting and Clustering: an Introduction
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
 
Bridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate PerspectiveBridging the Pervasive Computing Gap: An Aggregate Perspective
Bridging the Pervasive Computing Gap: An Aggregate Perspective
 
From Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate ComputingFrom Field-based Coordination to Aggregate Computing
From Field-based Coordination to Aggregate Computing
 
NodeJS: an Introduction
NodeJS: an IntroductionNodeJS: an Introduction
NodeJS: an Introduction
 
Spring Boot: a Quick Introduction
Spring Boot: a Quick IntroductionSpring Boot: a Quick Introduction
Spring Boot: a Quick Introduction
 
Introduction to cloud-native application development: with Heroku and Spring ...
Introduction to cloud-native application development: with Heroku and Spring ...Introduction to cloud-native application development: with Heroku and Spring ...
Introduction to cloud-native application development: with Heroku and Spring ...
 

Recently uploaded

4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
ssuserbfdca9
 
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATIONPRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
ChetanK57
 
Comparative structure of adrenal gland in vertebrates
Comparative structure of adrenal gland in vertebratesComparative structure of adrenal gland in vertebrates
Comparative structure of adrenal gland in vertebrates
sachin783648
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
pablovgd
 
Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...
Sérgio Sacani
 
Seminar of U.V. Spectroscopy by SAMIR PANDA
 Seminar of U.V. Spectroscopy by SAMIR PANDA Seminar of U.V. Spectroscopy by SAMIR PANDA
Seminar of U.V. Spectroscopy by SAMIR PANDA
SAMIR PANDA
 
Citrus Greening Disease and its Management
Citrus Greening Disease and its ManagementCitrus Greening Disease and its Management
Citrus Greening Disease and its Management
subedisuryaofficial
 
Structural Classification Of Protein (SCOP)
Structural Classification Of Protein  (SCOP)Structural Classification Of Protein  (SCOP)
Structural Classification Of Protein (SCOP)
aishnasrivastava
 
Orion Air Quality Monitoring Systems - CWS
Orion Air Quality Monitoring Systems - CWSOrion Air Quality Monitoring Systems - CWS
Orion Air Quality Monitoring Systems - CWS
Columbia Weather Systems
 
ESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptxESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptx
muralinath2
 
Cancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate PathwayCancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate Pathway
AADYARAJPANDEY1
 
extra-chromosomal-inheritance[1].pptx.pdfpdf
extra-chromosomal-inheritance[1].pptx.pdfpdfextra-chromosomal-inheritance[1].pptx.pdfpdf
extra-chromosomal-inheritance[1].pptx.pdfpdf
DiyaBiswas10
 
In silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptxIn silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptx
AlaminAfendy1
 
GBSN - Biochemistry (Unit 5) Chemistry of Lipids
GBSN - Biochemistry (Unit 5) Chemistry of LipidsGBSN - Biochemistry (Unit 5) Chemistry of Lipids
GBSN - Biochemistry (Unit 5) Chemistry of Lipids
Areesha Ahmad
 
platelets_clotting_biogenesis.clot retractionpptx
platelets_clotting_biogenesis.clot retractionpptxplatelets_clotting_biogenesis.clot retractionpptx
platelets_clotting_biogenesis.clot retractionpptx
muralinath2
 
Leaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdfLeaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdf
RenuJangid3
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
silvermistyshot
 
GBSN - Microbiology (Lab 4) Culture Media
GBSN - Microbiology (Lab 4) Culture MediaGBSN - Microbiology (Lab 4) Culture Media
GBSN - Microbiology (Lab 4) Culture Media
Areesha Ahmad
 
SCHIZOPHRENIA Disorder/ Brain Disorder.pdf
SCHIZOPHRENIA Disorder/ Brain Disorder.pdfSCHIZOPHRENIA Disorder/ Brain Disorder.pdf
SCHIZOPHRENIA Disorder/ Brain Disorder.pdf
SELF-EXPLANATORY
 
filosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptxfilosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptx
IvanMallco1
 

Recently uploaded (20)

4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
4. An Overview of Sugarcane White Leaf Disease in Vietnam.pdf
 
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATIONPRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
PRESENTATION ABOUT PRINCIPLE OF COSMATIC EVALUATION
 
Comparative structure of adrenal gland in vertebrates
Comparative structure of adrenal gland in vertebratesComparative structure of adrenal gland in vertebrates
Comparative structure of adrenal gland in vertebrates
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
 
Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...
 
Seminar of U.V. Spectroscopy by SAMIR PANDA
 Seminar of U.V. Spectroscopy by SAMIR PANDA Seminar of U.V. Spectroscopy by SAMIR PANDA
Seminar of U.V. Spectroscopy by SAMIR PANDA
 
Citrus Greening Disease and its Management
Citrus Greening Disease and its ManagementCitrus Greening Disease and its Management
Citrus Greening Disease and its Management
 
Structural Classification Of Protein (SCOP)
Structural Classification Of Protein  (SCOP)Structural Classification Of Protein  (SCOP)
Structural Classification Of Protein (SCOP)
 
Orion Air Quality Monitoring Systems - CWS
Orion Air Quality Monitoring Systems - CWSOrion Air Quality Monitoring Systems - CWS
Orion Air Quality Monitoring Systems - CWS
 
ESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptxESR_factors_affect-clinic significance-Pathysiology.pptx
ESR_factors_affect-clinic significance-Pathysiology.pptx
 
Cancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate PathwayCancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate Pathway
 
extra-chromosomal-inheritance[1].pptx.pdfpdf
extra-chromosomal-inheritance[1].pptx.pdfpdfextra-chromosomal-inheritance[1].pptx.pdfpdf
extra-chromosomal-inheritance[1].pptx.pdfpdf
 
In silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptxIn silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptx
 
GBSN - Biochemistry (Unit 5) Chemistry of Lipids
GBSN - Biochemistry (Unit 5) Chemistry of LipidsGBSN - Biochemistry (Unit 5) Chemistry of Lipids
GBSN - Biochemistry (Unit 5) Chemistry of Lipids
 
platelets_clotting_biogenesis.clot retractionpptx
platelets_clotting_biogenesis.clot retractionpptxplatelets_clotting_biogenesis.clot retractionpptx
platelets_clotting_biogenesis.clot retractionpptx
 
Leaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdfLeaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdf
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
 
GBSN - Microbiology (Lab 4) Culture Media
GBSN - Microbiology (Lab 4) Culture MediaGBSN - Microbiology (Lab 4) Culture Media
GBSN - Microbiology (Lab 4) Culture Media
 
SCHIZOPHRENIA Disorder/ Brain Disorder.pdf
SCHIZOPHRENIA Disorder/ Brain Disorder.pdfSCHIZOPHRENIA Disorder/ Brain Disorder.pdf
SCHIZOPHRENIA Disorder/ Brain Disorder.pdf
 
filosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptxfilosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptx
 

Towards Aggregate Programming in Scala

  • 1. Towards Aggregate Programming in Scala Roberto Casadei Mirko Viroli Department of Computer Science and Engineering University of Bologna 1st International Workshop on Programming Models and Languages for Distributed Computing (PMLDC), 2016, Rome R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 1 / 46
  • 2. Outline 1 Context and Issues 2 Aggregate Computing 3 Aggregate Programming in Scala 4 Summary R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 2 / 46
  • 3. Context and Issues Outline 1 Context and Issues 2 Aggregate Computing 3 Aggregate Programming in Scala 4 Summary R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 3 / 46
  • 4. Context and Issues Context Environment + (Mobile, Large-scale) Networks of { people + devices } R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 4 / 46
  • 5. Context and Issues The systems of ((((((( tomorrow today... Complex/Collective Adaptive Systems (CASs) • Socio-Technical Systems (STS) • Internet of Things (IoT) • Pervasive systems • Ubiquitous systems • Cyber-Physical Systems (CPS) • Smart-cities/buildings/homes, ... R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 5 / 46
  • 6. Context and Issues Ecosystems of CASs services The crowd engineering example R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 6 / 46
  • 7. Context and Issues Gathering local context R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 7 / 46
  • 8. Context and Issues Sensing global patterns of data R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 8 / 46
  • 9. Context and Issues Crowd detection R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 9 / 46
  • 10. Context and Issues Crowd anticipation R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 10 / 46
  • 11. Context and Issues Crowd-aware steering R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 11 / 46
  • 12. Context and Issues Crowd dispersal R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 12 / 46
  • 13. Context and Issues Crowd evacuation upon alerts R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 13 / 46
  • 14. Context and Issues What? How? The problem • Large-scale • Complex dynamics • Substantial unpredictability Approach • Decentralisation • Adaptation • To occasional disruptions • To on-going perturbation • To device distribution • To available infrastructure Design issues • Abstraction gap — i.e., the distance from the problem to the solution • Capturing complex behaviours in a simple way • Supporting modularity and reusability • Guiding engineering for resilience R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 14 / 46
  • 15. Context and Issues What? How? The problem • Large-scale • Complex dynamics • Substantial unpredictability Approach • Decentralisation • Adaptation • To occasional disruptions • To on-going perturbation • To device distribution • To available infrastructure Design issues • Abstraction gap — i.e., the distance from the problem to the solution • Capturing complex behaviours in a simple way • Supporting modularity and reusability • Guiding engineering for resilience R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 14 / 46
  • 16. Context and Issues What? How? The problem • Large-scale • Complex dynamics • Substantial unpredictability Approach • Decentralisation • Adaptation • To occasional disruptions • To on-going perturbation • To device distribution • To available infrastructure Design issues • Abstraction gap — i.e., the distance from the problem to the solution • Capturing complex behaviours in a simple way • Supporting modularity and reusability • Guiding engineering for resilience R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 14 / 46
  • 17. Aggregate Computing Outline 1 Context and Issues 2 Aggregate Computing 3 Aggregate Programming in Scala 4 Summary R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 15 / 46
  • 18. Aggregate Computing The origins: self-organisation patterns [FMSM+ 13] R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 16 / 46
  • 19. Aggregate Computing The origins: space-time programming [BV15] Space-oriented computation – Thematic areas (a) Intensive computing (b) Computation embedded in space (c) Space computation Decentralised spatial computing Computing “somewhere” [Duc13] • Location-related information • Spatial constraints to communication Space-time programming [BV15] • Computation expressed in terms of properties of the physical time and space in which it occurs • Spatial abstractions R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 17 / 46
  • 20. Aggregate Computing Discrete system vs. continuous space-time R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 18 / 46
  • 21. Aggregate Computing Computational fields • (Abstract interpretation) Mapping space-time to computational objects • (Concrete interpretation) Mapping devices to values: φ : δ → • “Distributed” data structure working as the global abstraction R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 19 / 46
  • 22. Aggregate Computing The Computational Field Calculus I Field calculus A calculus of computational fields [DVB16] • Functional • Basis set of operators for field manipulation • Minimal expressive model ≈ Space-time universal Higher-Order Field Calculus (HOFC) [DVPB15] • First-class distributed functions • Code mobility R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 20 / 46
  • 23. Aggregate Computing The Computational Field Calculus II Syntax e = x | v | eλ(e) | rep(e0){eλ} | nbr{e } Expression v = <standard-values> | λ Value λ = f | o | (x) ⇒ e Functional value F = def f(x){e } Function definition • v includes numbers, booleans, strings, collections, custom ADTs, etc. • f is a user-defined function • o is a built-in functional operator (e.g., pure math or a sensor) A sort of λ-calculus where values are computational fields, plus (i) a construct for field evolution (rep) (ii) a construct for interacting with the neighbourhood (nbr) R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 21 / 46
  • 24. Aggregate Computing The Computational Field Calculus III Global-level semantics, intuitively 0 (x)=>x+1 true t<0,1> ()0 1 + - 1 -1 ef(0,1) ef rep 0 (x)=>x+1 t v0 t v1 .. rep(0){(x)=>x+1} nbr de nbr{e} φd=[d1→v1,..,dn→vn] R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 22 / 46
  • 25. Aggregate Computing Example: the channel I R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 23 / 46
  • 26. Aggregate Computing Example: the channel II R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 24 / 46
  • 27. Aggregate Computing Aggregate functions [DVPB15] Left: branch(c){ f(x) }{ g(x) } Right: (branch(c){ f }{ g })(x) R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 25 / 46
  • 28. Aggregate Computing Aggregate programming [BPV15] Programming (collective adaptive) systems: viewpoints (a) Local viewpoint (device-centric view) (b) Global viewpoint (aggregate view) Aggregate programming: what Goal: programming the collective behaviour of aggregates Global-to-local mapping Aggregate programming: how Prominent approach founded on field calculus and self-org patterns Composable self-organisation • Self-stabilisation • Building blocks for resilient coordination R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 26 / 46
  • 29. Aggregate Computing Device-centric programming Issues • Local-to-global mapping problem (generally intractable) • Explicit design of adaptation and communication • Mixing of concerns — state management, interaction, adaptation, resiliency, etc. R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 27 / 46
  • 30. Aggregate Computing Device-centric programming Issues • Local-to-global mapping problem (generally intractable) • Explicit design of adaptation and communication • Mixing of concerns — state management, interaction, adaptation, resiliency, etc. R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 27 / 46
  • 31. Aggregate Computing Aggregate-level programming Collective services on the computational fabric available in space • Automatic global-to-local mapping • Implicit adaptation and communication • Composition of loosely coupled services R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 28 / 46
  • 32. Aggregate Computing Aggregate-level programming Collective services on the computational fabric available in space • Automatic global-to-local mapping • Implicit adaptation and communication • Composition of loosely coupled services R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 28 / 46
  • 33. Aggregate Computing Aggregate (computing) systems Structure A set of networked devices • Each one is given the same field calculus program Dynamics Each device computes the given program at asyn / partially-sync rounds of execution (1) Retrieve context ⇐ Messages from neighbours ⇐ Sensor values (2) Aggregate program execution ⇒ export (3) Broadcast export to neighbourhood (4) Execute actuators R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 29 / 46
  • 34. Aggregate Computing Aggregate computing and abstraction (Partial) insensitiveness to system structure and situation details Aggregate behaviours are highly insensitive to: • network size • network density • network topology This makes algorithms intrinsically robust to failures and changes to working conditions. (Partial) insensitiveness to execution strategy Note: network nodes ultimately correspond to components operating in some context via sensors/actuators. Aggregate computations can be carried out in different ways: • Computing nodes and “native” local communication; • Computations performed by a central server; • Computations performed in the cloud; ... Idea: opportunistically exploit the underlying infrastructure R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 30 / 46
  • 35. Aggregate Computing Aggregate Programming Stack R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 31 / 46
  • 36. Aggregate Computing Approaching the engineering of CASs Approaching the aforementioned issues • Abstraction gap — i.e., the distance from the problem to the solution =⇒ Abstractions close to problem domain =⇒ Declarative approach – from how to what =⇒ Layered approach – raising abstraction incrementally • Capturing complex behaviours in a simple way =⇒ Instrumental assumptions + effective building blocks =⇒ Balance of top-down and bottom-up problem solving • Supporting modularity and reusability =⇒ Compositional approach • Guiding engineering for resilience =⇒ Adaptation by construction R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
  • 37. Aggregate Computing Approaching the engineering of CASs Approaching the aforementioned issues • Abstraction gap — i.e., the distance from the problem to the solution =⇒ Abstractions close to problem domain =⇒ Declarative approach – from how to what =⇒ Layered approach – raising abstraction incrementally • Capturing complex behaviours in a simple way =⇒ Instrumental assumptions + effective building blocks =⇒ Balance of top-down and bottom-up problem solving • Supporting modularity and reusability =⇒ Compositional approach • Guiding engineering for resilience =⇒ Adaptation by construction R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
  • 38. Aggregate Computing Approaching the engineering of CASs Approaching the aforementioned issues • Abstraction gap — i.e., the distance from the problem to the solution =⇒ Abstractions close to problem domain =⇒ Declarative approach – from how to what =⇒ Layered approach – raising abstraction incrementally • Capturing complex behaviours in a simple way =⇒ Instrumental assumptions + effective building blocks =⇒ Balance of top-down and bottom-up problem solving • Supporting modularity and reusability =⇒ Compositional approach • Guiding engineering for resilience =⇒ Adaptation by construction R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
  • 39. Aggregate Computing Approaching the engineering of CASs Approaching the aforementioned issues • Abstraction gap — i.e., the distance from the problem to the solution =⇒ Abstractions close to problem domain =⇒ Declarative approach – from how to what =⇒ Layered approach – raising abstraction incrementally • Capturing complex behaviours in a simple way =⇒ Instrumental assumptions + effective building blocks =⇒ Balance of top-down and bottom-up problem solving • Supporting modularity and reusability =⇒ Compositional approach • Guiding engineering for resilience =⇒ Adaptation by construction R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
  • 40. Aggregate Computing Approaching the engineering of CASs Approaching the aforementioned issues • Abstraction gap — i.e., the distance from the problem to the solution =⇒ Abstractions close to problem domain =⇒ Declarative approach – from how to what =⇒ Layered approach – raising abstraction incrementally • Capturing complex behaviours in a simple way =⇒ Instrumental assumptions + effective building blocks =⇒ Balance of top-down and bottom-up problem solving • Supporting modularity and reusability =⇒ Compositional approach • Guiding engineering for resilience =⇒ Adaptation by construction R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 32 / 46
  • 41. Aggregate Computing Aggregate Programming Toolchain Up to a few months ago.. Protelis [PVB15] + Alchemist simulator [PMV13] • External DSL • Focus on simulation Technological gap: there is no aggregate programming framework, aimed at the construction of real-world applications, integrated in a ≈mainstream language ⇒ SCAFI (scala with computational fields) • Scala-internal DSL for expressing aggregate computations • Distributed platform for execution of aggregate systems SCAFI: where? http://scafi.apice.unibo.it • A more serious release soon :) R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 33 / 46
  • 42. Aggregate Programming in Scala Outline 1 Context and Issues 2 Aggregate Computing 3 Aggregate Programming in Scala 4 Summary R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 34 / 46
  • 43. Aggregate Programming in Scala SCAFI: Scala with Computational Fields Goal The goal is to provide an integrated framework for building systems with aggregate programming • Scala-internal DSL for expressing aggregate computations • Linguistic support + execution support (interpreter/VM) • Correct, complete, efficient implementation of the HOFC semantics • Distributed platform for execution of aggregate systems • Support for multiple architectural styles and system configurations • Support for code mobility Issues • Implementation of a language for the field calculus within Scala • Constructs as method calls • Integration with the Scala type system • Development of a distributed middleware • Typical issues from distribution (concurrency, communication, fault-tolerance) ⇒ Akka actor framework R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 35 / 46
  • 44. Aggregate Programming in Scala SCAFI: language trait Constructs { def rep[A](init: A) (fun: (A) => A): A def nbr[A](expr: => A): A def foldhood[A](init: => A) (acc: (A,A)=>A) (expr: => A): A def branch[A](cond: => Boolean) (th: => A) (el: => A): A def aggregate[A](f: => A): A def sense[A](name: LSNS): A def nbrvar[A](name: NSNS): A } Where are computational fields? R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 36 / 46
  • 45. Aggregate Programming in Scala Example: the channel I def channel(src: Boolean, dest: Boolean, width: Double) = distanceTo(src) + distanceTo(dest) <= distBetween(src, dest) + width R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 37 / 46
  • 46. Aggregate Programming in Scala Example: the channel (full code) def channel(src: Boolean, dest: Boolean, width: Double) = distanceTo(src) + distanceTo(dest) <= distBetween(src, dest) + width def nbrRange(): Double = nbrvar[Double](NBR_RANGE_NAME) def G[V:OB](src: Boolean, field: V, acc: V=>V, metric: =>Double): V = rep( (Double.MaxValue, field) ){ dv => mux(src) { (0.0, field) } { minHoodMinus { val (d, v) = nbr { (dv._1, dv._2) } (d + metric, acc(v)) } } }._2 def broadcast[V:OB](source: Boolean, field: V): V = G[V](source, field, x=>x, nbrRange()) def distanceTo(source: Boolean): Double = G[Double](source, 0, _ + nbrRange(), nbrRange()) def distBetween(source: Boolean, target: Boolean): Double = broadcast(source, distanceTo(target)) def isSource = sense[Boolean]("source") def isObstacle = sense[Boolean]("obstacle") R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 38 / 46
  • 47. Aggregate Programming in Scala P2p, ad-hoc net // STEP 1: CHOOSE INCARNATION import it.unibo.scafi.incarnations.{ BasicActorP2P => Platform } // STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA class Demo0C_AggregateProgram extends Platform.AggregateProgram { override def main(): Any = foldhood(0){_ + _}(1) } // STEP 3: DEFINE MAIN PROGRAM object Demo0C_MainProgram extends Platform.CmdLineMain 1) Demo_MainProgram -h 127.0.0.1 -p 9000 -e 1:2,4,5;2;3 --subsystems 127.0.0.1:9500:4:5 --program "demos.Demo_AggregateProgram" 2) Demo_MainProgram -h 127.0.0.1 -p 9500 -e 4;5:4 --program "demos.Demo_AggregateProgram" R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 39 / 46
  • 48. Aggregate Programming in Scala Server-based, mobile spatial net I import it.unibo.scafi.distrib.actor.server.{SpatialPlatform => SpatialServerBasedActorPlatform} import it.unibo.scafi.incarnations.BasicAbstractActorIncarnation import it.unibo.scafi.space.{Point2D, BasicSpatialAbstraction} object Demo3_Platform extends BasicAbstractActorIncarnation with SpatialServerBasedActorPlatform with BasicSpatialAbstraction with Serializable { override val LocationSensorName: String = "LOCATION_SENSOR" override type P = Point2D override def buildNewSpace[E](elems: Iterable[(E,P)]): SPACE[E] = new Basic3DSpace(elems.toMap) { override val proximityThreshold = 1.1 } } // STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA class Demo3_AggregateProgram extends Demo3_Platform.AggregateProgram { def hopGradient(source: Boolean): Double = { rep(Double.PositiveInfinity){ hops => { mux(source) { 0.0 } { 1+minHood(nbr{ hops }) } } } } def main() = hopGradient(sense("source")) } R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 40 / 46
  • 49. Aggregate Programming in Scala Server-based, mobile spatial net II // STEP 3: DEFINE MAIN PROGRAMS object Demo3_ServerMain extends Demo3_Platform.ServerCmdLineMain { override def refineSettings(s: Demo3_Platform.Settings) = { s.copy(profile = s.profile.copy( serverGuiActorProps = tm => Some(ServerGUIActor.props(Demo3_Platform, tm )) )) } } object Demo4_MainProgram extends Demo3_Platform.CmdLineMain { override def refineSettings(s: Demo3_Platform.Settings) = { s.copy(profile = s.profile.copy( devGuiActorProps = ref => Some(DevGUIActor.props(Demo3_Platform, ref)) )) } override def onDeviceStarted(dm: Demo3_Platform.DeviceManager, sys: Demo3_Platform.SystemFacade) = { dm.addSensorValue(Demo3_Platform.LocationSensorName, Point2D(dm.selfId%5,( dm.selfId/5.0).floor)) dm.addSensorValue("source", dm.selfId==4) dm.start } } R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 41 / 46
  • 50. Aggregate Programming in Scala Server-based, mobile spatial net III R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 42 / 46
  • 51. Summary Outline 1 Context and Issues 2 Aggregate Computing 3 Aggregate Programming in Scala 4 Summary R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 43 / 46
  • 52. Summary Summary: key ideas and future directions Aggregate programming • An ((((((( programmingengineering approach to CASs • Formally grounded in the Field Calculus • Allows to compose “emergent” phenomena • Provides layers of building blocks (proven to self-stabilise!) A Scala framework for aggregate programming is out! • Supports the construction of aggregate systems • Integrated in Scala No need to learn ad-hoc external DSLs Easier to get started and play • Better release (e.g., to Maven Central) soon, I promise :) Many open problems [VB] (want to join?) • Space-time universality • Fields vs. objects/agents/processes/worflows • Better resilience properties than self-stabilisation • Adapting the execution strategy to available infrastructure (e.g., cloud, fog, ...) R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 44 / 46
  • 53. Appendix References References I [BPV15] Jacob Beal, Danilo Pianini, and Mirko Viroli. Aggregate Programming for the Internet of Things. IEEE Computer, 2015. [BV15] Jacob Beal and Mirko Viroli. Space–time programming. Phil. Trans. R. Soc. A, 373(2046):20140220, 2015. [Duc13] Matt Duckham. Decentralized Spatial Computing - Foundations of Geosensor Networks. Springer, 2013. [DVB16] Ferruccio Damiani, Mirko Viroli, and Jacob Beal. A type-sound calculus of computational fields. Science of Computer Programming, 117:17 – 44, 2016. [DVPB15] Ferruccio Damiani, Mirko Viroli, Danilo Pianini, and Jacob Beal. Code mobility meets self-organisation: A higher-order calculus of computational fields. volume 9039 of Lecture Notes in Computer Science, pages 113–128. Springer International Publishing, 2015. R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 45 / 46
  • 54. Appendix References References II [FMSM+ 13] Jose Luis Fernandez-Marquez, Giovanna Di Marzo Serugendo, Sara Montagna, Mirko Viroli, and Josep Lluís Arcos. Description and composition of bio-inspired design patterns: a complete overview. Natural Computing, 12(1):43–67, 2013. [PMV13] Danilo Pianini, Sara Montagna, and Mirko Viroli. Chemical-oriented simulation of computational systems with alchemist. Journal of Simulation, 7(3):202–215, 2013. [PVB15] Danilo Pianini, Mirko Viroli, and Jacob Beal. Protelis: practical aggregate programming. In Proceedings of the 30th Annual ACM Symposium on Applied Computing, pages 1846–1853. ACM, 2015. [VB] Mirko Viroli and Jacob Beal. Resiliency with Aggregate Computing : State of the Art and Roadmap. R. Casadei (Università di Bologna) Towards Aggregate Programming in Scala PMLDC 2016 46 / 46