Functional Programming
Functional Programming
Distributed Computing
Fanyu Ran • Yang Zhou • Yuhang Gao • Yuhao Lu
● Distributed Computing
● Problem with OOP
Overview
● Functional Programming
● What can FP offer
● FP and Distributed Computing
Distributed Computing
Purpose Basic Issue
● Parallel, High-Performance ● Utilization and cooperation of
Applications multiple processors.
● Fault-tolerant Applications
Image from:
https://www.keil.com/pack/doc/cmsis/RTOS/html/group__CMSIS__RTOS__MutexMgmt.html
Deadlock
First-Class &
TCO, Closure,
Purity Immutability High-Order Curry…
Function
Purity
● The function always evaluates the same
result value given the same argument
value(s).
● Evaluation of the result does not cause any
semantically observable side effect or
output, such as mutation of mutable
Purity
objects or output to I/O devices.
https://en.wikipedia.org/wiki/Pure_function
State of objects cannot be
modified after it is created.
Immutability
How can we program without
modifying state ?
Loop as an example:
Immutability
Capability of programming language to:
First-Class Function
● store functions in data structures
https://en.wikipedia.org/wiki/First-class_function
Function that does at least one of the following
High-Order Function
What can FP offer to distributed computing ?
No side-effects and mutable Functions as building blocks
variables
Functions can be combined, sent remotely
FP facilitates code distribution over several and applied locally on distributed data sets.
CPU and eases concurrent programming.
What is Elixir?
Erlang/Elixir
development and the embedded software
domain(e.g.2 Million Websocket
Connections in single machine).
NINE nines(99.9999999% reliability)?