Presented by: @tomfriedhof
Code Examples: https://actvl.mp/38w5RVrOptional static type-checking along with the latest ECMAScript features.
is a paradigm of building software using composable functions
Ubiquitous Design Pattern
This is an OOP principle
$ ps aux | grep www-data
php:
image: php:7.4.1
nginx:
image: nginx:1.15.3-alpine
database:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: lamp
MYSQL_PASSWORD: lamp
MYSQL_DATABASE: lamp
is a paradigm of building software using composable functions
function add(a, b) {
return a + b;
}
const c = 3;
function impureAdd(a, b) {
return a + b + c;
}
Impure Functions interact with the outside world, pure functions do not.
Currying is when you break down a function that takes multiple arguments into a series of functions that each take only one argument.
let val = calc.addPure(1, 1);
val = calc.addPure(5, val);
val = calc.addPure(7, val);
Pipe previous value to next operation (Composing)
1 | calc.addPure(1) | calc.addPure(5) | calc.addPure(7)
Function composition is the process of combining two or more functions in order to produce a new function or perform some computation.
const result = R.compose(R.divide(150), R.multiply(5), add(10));
let val = result(5);
Declarative - Spreadsheet formulas
Imperative - jQuery
// Psuedo jquery example
$('#switch').click(() => {
$('#bulb').toggle();
});
// @file light-switch.js
let switchPower = localStorage.getItem('switchPower') || false;
$('#switch').click(() => {
localStorage.setItem('switchPower', !switchPower);
});
// @file bulb.js
let switchPower = localStorage.getItem('switchPower') || false;
$('#bulb').addClass(switchPower ? 'bulb-on' : 'bulb-off');
UI decides how to render based on parameter passed in (state).
In ReactiveX an observer subscribes to an Observable. Then that observer reacts to whatever item or sequence of items the Observable emits.
http://reactivex.io/documentation/observable.htmlRxJS is mainly about the operators!
const result$ = combineLatest(seconds$.pipe(
map((x: number) => x * 5)
), clickEvents$);