SlideShare a Scribd company logo
NO MORE PROMISES. LET'S RXJS
REACTIVE EXTENSIONS FOR JAVASCRIPT
A B O U T M E
{
"name": "Ilia Idakiev",
"experience": [
“Google Developer Expert (GDE)“,
"Developer & Co-founder @ HILLGRAND",
"Lecturer in 'Advanced JS' @ Sofia University",
"Contractor / Consultant",
"Public / Private Courses”
],
"involvedIn": [
"Angular Sofia", "SofiaJS / BeerJS",
]
}
!
FUNCTIONAL
PROGRAMMING
REACTIVE EXTENSIONS FOR JAVASCRIPT
FUNCTIONAL PROGRAMMING
▸ Functional programming is a programming paradigm
that treats computation as the evaluation of mathematical
functions and avoids changing-state and mutable data. It is
a declarative programming paradigm, which means
programming is done with expressions or declarations
instead of statements.
REACTIVE EXTENSIONS FOR JAVASCRIPT
IMPERATIVE VS DECLARATIVE PROGRAMMING
function getAdmins(users) {
const admins = [];
for (let i = 0; i < users.length; i++) {
const currentUser = users[i];
if (!currentUser.isAdmin) { continue; }
admins.push(currentUser);
}
return admins;
}
Imperative programming focuses on describing how a
program operates.
function getAdmins(users) {
return users.filter(
currentUser => currentUser.isAdmin
);
}
Declarative programming focuses on expressing the logic
of a computation without describing its control flow.
REACTIVE EXTENSIONS FOR JAVASCRIPT
FUNCTIONAL CONCEPTS
▸ Pure Functions
▸ Return the same value given the same arguments.
▸ Its evaluation has no side effects.
▸ Composition - pure functions can be composed.
▸ Immutability - don’t mutate state.
▸ Higher-order functions (Functions as first-class citizens)
▸ takes one or more functions as arguments.

▸ returns a function as its result.
▸ Currying and Partial Application - translating the evaluation of a function that takes multiple arguments into evaluating a
sequence of functions.
▸ Lazy evaluation - evaluate when needed.
and / or
REACTIVE EXTENSIONS FOR JAVASCRIPT
REFERENTIAL TRANSPARENCY
▸ An expression is called referentially transparent if it can be replaced with its
corresponding value without changing the program's behaviour. This requires
that the expression is pure, that is to say the expression value must be the same
for the same inputs and its evaluation must have no side effects.
REACTIVE EXTENSIONS FOR JAVASCRIPT
FUNCTIONAL PROGRAMMING ADVANTAGES
▸ Clean Code - Easy to test, debug and reason about (no side effects).
▸ Modularity - Breaking large problems into small parts.
▸ Reusability - Pure functions can be reused and composed.
▸ Efficiency - Lazy Evaluation (evaluate when needed)
ASYNCHRONY
REACTIVE EXTENSIONS FOR JAVASCRIPT
ASYNCHRONOUS JAVASCRIPT
▸ Continuation Passing Style (CPS)
▸ CPS with named callbacks (to reduce callback hell)
▸ Futures and Promises / async - await
▸ Async data streams - RxJS
FUTURES AND PROMISES
REACTIVE EXTENSIONS FOR JAVASCRIPT
▸ Futures and promises originated in functional programming and related
paradigms (such as logic programming) to decouple a value (a future) from
how it was computed (a promise), allowing the computation to be done
more flexibly, notably by parallelizing it.
WHERE DO PROMISES COME FROM?
REACTIVE EXTENSIONS FOR JAVASCRIPT
▸ A Promise is a proxy for a value not necessarily known when the promise is
created.
▸ It allows you to associate handlers with an asynchronous action's eventual
success value or failure reason.
▸ This lets asynchronous methods return values like synchronous methods:
instead of immediately returning the final value, the asynchronous method
returns a promise to supply the value at some point in the future.
PROMISES
REACTIVE EXTENSIONS FOR JAVASCRIPT
▸ Pending - initial state, neither fulfilled nor rejected.
▸ Fulfilled - the operation completed successfully.
▸ Rejected - the operation failed.
PROMISE STATES (STATE MACHINE)
REACTIVE EXTENSIONS FOR JAVASCRIPT
PROMISE EXAMPLE
const promise = new Promise(function (resolve, reject) {
setTimeout(function () {
const randomNumber = Math.floor(Math.random() * Math.floor(10));
if (randomNumber % 2 === 0) {
resolve('Success');
return;
}
reject('Error');
}, 300);
});
promise.then(console.log).catch(console.error);
Controlling the machine state
REACTIVE EXTENSIONS FOR JAVASCRIPT
PROMISE EXAMPLE (2)
Promise.resolve(10).then(x => x + 10).then(console.log);
WAIT A MINUTE
THIS LOOKS VERY SIMILAR TO…
REACTIVE EXTENSIONS FOR JAVASCRIPT
JS ARRAYS
[10].map(x => x + 1).forEach(console.log);
WHY IS IT CALLED MAP?
CATEGORY THEORY
REACTIVE EXTENSIONS FOR JAVASCRIPT
▸ Mathematical Abstractions - Helps us getting rid of details so we can look at
things a different way.
CATEGORY THEORY
REACTIVE EXTENSIONS FOR JAVASCRIPT
CATEGORIES
▸ A category consists of a collection of objects (just
abstractions) and morphisms (functions).

(X, Y, Z - objects)
▸ The morphisms must obey the following laws:
▸ They must me composable.
▸ Compositions must me associative.
▸ For each object a, there is an identity morphism.
REACTIVE EXTENSIONS FOR JAVASCRIPT
CATEGORY THEORY IN JAVASCRIPT
add(1, 1) // > 2 - persists type
add(1, 0) // > 1 - identity function
add(1, 2) === add(2, 1) // > 3 - commutative
add(add(1, 2), 3) === add(1, add(2, 3)); // > 6 - associative and composable
multiply(2, add(3, 4)) === add(multiply(2, 3), multiply(2, 4)) // > 14 - distributive
REACTIVE EXTENSIONS FOR JAVASCRIPT
FUNCTORS
▸ A structure-preserving mapping between categories.
▸ Let A and B be categories. A functor F from A to B is a mapping that:
▸ associates to each object a in A an object F(a) in B.
▸ associates to each morphism f in A a morphism F(f) in B such that the
following two conditions hold:
▸ F(ID(x)) = ID(F(X))
▸ F(g o f) = F(f) o F(g) for all morphisms f: x -> y, g: y -> z in A.
REACTIVE EXTENSIONS FOR JAVASCRIPT
CATEGORY THEORY OBJECTS IN JAVASCRIPT
const containerPrototype = {
map: function (fn) {
return Container(fn(this.value));
}
}
function Container(value) {
return Object.create(containerPrototype, { value: { value } });
}
console.log(Container(10).map(x => x + 100)); // > Container { value: 110 }
REACTIVE EXTENSIONS FOR JAVASCRIPT
CATEGORY THEORY OBJECTS IN JAVASCRIPT
Container(10).map(x => x + 100).map(x => '' + x); // > Container { value: '110' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
CATEGORY THEORY OBJECTS IN JAVASCRIPT
[10].map(x => x + 100).map(x => '' + x);
REACTIVE EXTENSIONS FOR JAVASCRIPT
CATEGORY THEORY OBJECTS IN JAVASCRIPT
[10].map(x => x + 100).map(x => '' + x);
It’s a functor!
ARE PROMISES FUNCTORS?
REACTIVE EXTENSIONS FOR JAVASCRIPT
PROMISE EXAMPLE (3)
Promise.resolve(10).then(x => x + 100).then(x => '' + x); // > Promise { value: '110' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
PROMISE EXAMPLE (4)
Promise.resolve(10).then(x => Promise.resolve(x + 100)).then(x => '' + x);
// > Promise { value: '110' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
PROMISE EXAMPLE (4)
Promise.resolve(10).then(x => Promise.resolve(x + 100)).then(x => '' + x);
// > Promise { value: '110' }
It’s flattening the structure! It’s not a functor!
REACTIVE EXTENSIONS FOR JAVASCRIPT
MONADS
▸ An extended functor.
▸ It can be used as container to wrap values.
▸ It can flatten the structure.
WHY DO WE NEED MONADS
AND FUNCTORS?
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // Maybe { value: null }
console.log(matchFirst('test', /rest/)); // Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // Maybe { value: null }
console.log(matchFirst('test', /rest/)); // Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // Maybe { value: null }
console.log(matchFirst('test', /rest/)); // Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // Maybe { value: null }
console.log(matchFirst('test', /rest/)); // Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // Maybe { value: null }
console.log(matchFirst('test', /rest/)); // Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // > Maybe { value: null }
console.log(matchFirst('test', /rest/)); // Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // > Maybe { value: null }
console.log(matchFirst('test', /rest/)); // > Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
REACTIVE EXTENSIONS FOR JAVASCRIPT
MAYBE FUNCTOR
const maybePrototype = {
map: function (fn) {
return this.value !== null ? Maybe(fn(this.value)) : Maybe(null);
}
}
function Maybe(value) {
return Object.create(maybePrototype, { value: { value } });
}
function matchFirst(string, regexp) {
return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]);
}
console.log(matchFirst(null, /test/)); // > Maybe { value: null }
console.log(matchFirst('test', /rest/)); // > Maybe { value: null }
console.log(matchFirst('test1test2', /testd/)); // > Maybe { value: 'test1' }
SO WHAT ABOUT RXJS?
WHAT IS RXJS?
MARBLE TESTING RXJS STREAMS
REACTIVE EXTENSIONS FOR JAVASCRIPT
▸ RxJS is a library for reactive programming using
Observables, to make it easier to compose
asynchronous or callback-based code.
REACTIVE EXTENSIONS FOR JAVASCRIPT
CREATING AN OBSERVABLE (THE OLD WAY)
import 'rxjs/add/observable/of';
import ‘rxjs/add/operator/map';
of(10).map(x => x + 100).map(x => '' + x).subscribe(console.log);
REACTIVE EXTENSIONS FOR JAVASCRIPT
CREATING AN OBSERVABLE
import { of } from ‘rxjs';
import { map } from ‘rxjs/operators';
of(10).pipe(map(x => x + 100), map(x => '' + x)).subscribe(console.log);
IT’S A MONAD!
WHAT ARE THE DIFFERENCES
RXJS AND PROMISES?
REACTIVE EXTENSIONS FOR JAVASCRIPT
CREATING AN OBSERVABLE STREAM (1)
import { from } from ‘rxjs';
import { map } from ‘rxjs/operators';
const stream$ = from([1, 2, 3, 4]).pipe(map(x => x + 1));
stream$.subscribe(console.log)
// > 2
// > 3
// > 4
// > 5
REACTIVE EXTENSIONS FOR JAVASCRIPT
CREATING AN OBSERVABLE STREAM (2)
import { interval } from ‘rxjs';
import { publish } from ‘rxjs/operators’;
const connectableTimer = interval(1000).pipe(publish());
connectableTimer.connect();
setTimeout(function () {
connectableTimer.subscribe(console.log);
// > 4
// > 5
// > 6
// > 7
// ...
}, 5000)
REACTIVE EXTENSIONS FOR JAVASCRIPT
HOT AND COLD OBSERVABLES
▸ Cold - An observable is “cold” if its underlying producer is created and
activated during subscription.
▸ Hot - An observable is “hot” if its underlying producer is either created or
activated outside of subscription.
1. OBSERVABLES ARE
STREAMS OF DATA(One or more values)
WHAT ELSE?
REACTIVE EXTENSIONS FOR JAVASCRIPT
COMMON THINGS THAT WE NEED
▸ debouncing
▸ cancelation
▸ retrying
▸ throttling
▸ timeouts
▸ detect only if something changed
RXJS HAS THEM ALL
2. BETTER FLOW CONTROL
(using the rxjs operators and rxjs observable factories/combiners)
3. OBSERVABLES ARE CANCELLABLE
(using unsubscribe)
4. OBSERVABLES ARE LAZY
(we have to explicitly state that we want the observable to start)
WHAT IS COMMON ABOUT
RXJS AND PROMISES?
MARBLE TESTING RXJS STREAMS
WHAT IS COMMON ABOUT RXJS AND PROMISES?
▸ They are both monads.
▸ Both monads are used to capture the effect of latency.
WHY ARE THEY REACTIVE?
DEMO
MARBLE TESTING RXJS STREAMS
CONNECT
GitHub > https://github.com/iliaidakiev (/slides/ - list of future and past events)
Twitter > @ilia_idakiev
THANK YOU!

More Related Content

What's hot

CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29
Bilal Ahmed
 
Bottom Up
Bottom UpBottom Up
Bottom Up
Brian Moschel
 
The underestimated power of KeyPaths
The underestimated power of KeyPathsThe underestimated power of KeyPaths
The underestimated power of KeyPaths
Vincent Pradeilles
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3
rohassanie
 
Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)
RichardWarburton
 
The Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana IsakovaThe Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana Isakova
Vasil Remeniuk
 
FP 201 Unit 3
FP 201 Unit 3 FP 201 Unit 3
FP 201 Unit 3
rohassanie
 
Qt Widget In-Depth
Qt Widget In-DepthQt Widget In-Depth
Qt Widget In-Depth
account inactive
 
From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)
Jordi Cabot
 
Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...
Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...
Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...
Sanjeev_Knoldus
 
Cprogramcontrolifelseselection3
Cprogramcontrolifelseselection3Cprogramcontrolifelseselection3
Cprogramcontrolifelseselection3
Karthika Parthasarathy
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
Julie Iskander
 
Headless Js Testing
Headless Js TestingHeadless Js Testing
Headless Js Testing
Brian Moschel
 
Kpi driven-java-development-fn conf
Kpi driven-java-development-fn confKpi driven-java-development-fn conf
Kpi driven-java-development-fn conf
Anirban Bhattacharjee
 
Javascript do jeito certo
Javascript do jeito certoJavascript do jeito certo
Javascript do jeito certo
Alexandre Gomes
 
Anonymous functions in JavaScript
Anonymous functions in JavaScriptAnonymous functions in JavaScript
Anonymous functions in JavaScript
Mohammed Sazid Al Rashid
 
Improving Correctness with Types Kats Conf
Improving Correctness with Types Kats ConfImproving Correctness with Types Kats Conf
Improving Correctness with Types Kats Conf
Iain Hull
 
Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8
RichardWarburton
 
Improving Correctness With Type - Goto Con Berlin
Improving Correctness With Type - Goto Con BerlinImproving Correctness With Type - Goto Con Berlin
Improving Correctness With Type - Goto Con Berlin
Iain Hull
 
Improving Correctness with Types
Improving Correctness with TypesImproving Correctness with Types
Improving Correctness with Types
Iain Hull
 

What's hot (20)

CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29
 
Bottom Up
Bottom UpBottom Up
Bottom Up
 
The underestimated power of KeyPaths
The underestimated power of KeyPathsThe underestimated power of KeyPaths
The underestimated power of KeyPaths
 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3
 
Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)
 
The Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana IsakovaThe Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana Isakova
 
FP 201 Unit 3
FP 201 Unit 3 FP 201 Unit 3
FP 201 Unit 3
 
Qt Widget In-Depth
Qt Widget In-DepthQt Widget In-Depth
Qt Widget In-Depth
 
From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)
 
Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...
Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...
Scala traits training by Sanjeev Kumar @Kick Start Scala traits & Play, organ...
 
Cprogramcontrolifelseselection3
Cprogramcontrolifelseselection3Cprogramcontrolifelseselection3
Cprogramcontrolifelseselection3
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Headless Js Testing
Headless Js TestingHeadless Js Testing
Headless Js Testing
 
Kpi driven-java-development-fn conf
Kpi driven-java-development-fn confKpi driven-java-development-fn conf
Kpi driven-java-development-fn conf
 
Javascript do jeito certo
Javascript do jeito certoJavascript do jeito certo
Javascript do jeito certo
 
Anonymous functions in JavaScript
Anonymous functions in JavaScriptAnonymous functions in JavaScript
Anonymous functions in JavaScript
 
Improving Correctness with Types Kats Conf
Improving Correctness with Types Kats ConfImproving Correctness with Types Kats Conf
Improving Correctness with Types Kats Conf
 
Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8
 
Improving Correctness With Type - Goto Con Berlin
Improving Correctness With Type - Goto Con BerlinImproving Correctness With Type - Goto Con Berlin
Improving Correctness With Type - Goto Con Berlin
 
Improving Correctness with Types
Improving Correctness with TypesImproving Correctness with Types
Improving Correctness with Types
 

Similar to No More Promises! Let's RxJS!

No more promises lets RxJS 2 Edit
No more promises lets RxJS 2 EditNo more promises lets RxJS 2 Edit
No more promises lets RxJS 2 Edit
Ilia Idakiev
 
Reactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz KhambatiReactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz Khambati
Aziz Khambati
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
scalaconfjp
 
Javascript: the important bits
Javascript: the important bitsJavascript: the important bits
Javascript: the important bits
Chris Saylor
 
Testowanie JavaScript
Testowanie JavaScriptTestowanie JavaScript
Testowanie JavaScript
Tomasz Bak
 
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
Ben Teese
 
JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8
Rafael Casuso Romate
 
Functional programming in javascript
Functional programming in javascriptFunctional programming in javascript
Functional programming in javascript
Boris Burdiliak
 
JavaScript Interview Questions 2023
JavaScript Interview Questions 2023JavaScript Interview Questions 2023
JavaScript Interview Questions 2023
Laurence Svekis ✔
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScript
Mark Shelton
 
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
GreeceJS
 
Cycle.js - A functional reactive UI framework
Cycle.js - A functional reactive UI frameworkCycle.js - A functional reactive UI framework
Cycle.js - A functional reactive UI framework
Nikos Kalogridis
 
RxJS Evolved
RxJS EvolvedRxJS Evolved
RxJS Evolved
trxcllnt
 
React, Redux, ES2015 by Max Petruck
React, Redux, ES2015   by Max PetruckReact, Redux, ES2015   by Max Petruck
React, Redux, ES2015 by Max Petruck
Maksym Petruk
 
Recompacting your react application
Recompacting your react applicationRecompacting your react application
Recompacting your react application
Greg Bergé
 
Apache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationApache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customization
Bartosz Konieczny
 
Rx workshop
Rx workshopRx workshop
Rx workshop
Ryan Riley
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
React, Redux, ES2015 by Max Petruck
React, Redux, ES2015 by Max PetruckReact, Redux, ES2015 by Max Petruck
React, Redux, ES2015 by Max Petruck
Lingvokot
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
Mario Fusco
 

Similar to No More Promises! Let's RxJS! (20)

No more promises lets RxJS 2 Edit
No more promises lets RxJS 2 EditNo more promises lets RxJS 2 Edit
No more promises lets RxJS 2 Edit
 
Reactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz KhambatiReactive Programming - ReactFoo 2020 - Aziz Khambati
Reactive Programming - ReactFoo 2020 - Aziz Khambati
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
 
Javascript: the important bits
Javascript: the important bitsJavascript: the important bits
Javascript: the important bits
 
Testowanie JavaScript
Testowanie JavaScriptTestowanie JavaScript
Testowanie JavaScript
 
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
The Return of JavaScript: 3 Open-Source Projects that are driving JavaScript'...
 
JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8
 
Functional programming in javascript
Functional programming in javascriptFunctional programming in javascript
Functional programming in javascript
 
JavaScript Interview Questions 2023
JavaScript Interview Questions 2023JavaScript Interview Questions 2023
JavaScript Interview Questions 2023
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScript
 
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
 
Cycle.js - A functional reactive UI framework
Cycle.js - A functional reactive UI frameworkCycle.js - A functional reactive UI framework
Cycle.js - A functional reactive UI framework
 
RxJS Evolved
RxJS EvolvedRxJS Evolved
RxJS Evolved
 
React, Redux, ES2015 by Max Petruck
React, Redux, ES2015   by Max PetruckReact, Redux, ES2015   by Max Petruck
React, Redux, ES2015 by Max Petruck
 
Recompacting your react application
Recompacting your react applicationRecompacting your react application
Recompacting your react application
 
Apache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationApache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customization
 
Rx workshop
Rx workshopRx workshop
Rx workshop
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
 
React, Redux, ES2015 by Max Petruck
React, Redux, ES2015 by Max PetruckReact, Redux, ES2015 by Max Petruck
React, Redux, ES2015 by Max Petruck
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
 

More from Ilia Idakiev

Enterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platformEnterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platform
Ilia Idakiev
 
Deep Dive into Zone.JS
Deep Dive into Zone.JSDeep Dive into Zone.JS
Deep Dive into Zone.JS
Ilia Idakiev
 
RxJS Schedulers - Controlling Time
RxJS Schedulers - Controlling TimeRxJS Schedulers - Controlling Time
RxJS Schedulers - Controlling Time
Ilia Idakiev
 
Creating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-htmlCreating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-html
Ilia Idakiev
 
Marble Testing RxJS streams
Marble Testing RxJS streamsMarble Testing RxJS streams
Marble Testing RxJS streams
Ilia Idakiev
 
Deterministic JavaScript Applications
Deterministic JavaScript ApplicationsDeterministic JavaScript Applications
Deterministic JavaScript Applications
Ilia Idakiev
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components Everywhere
Ilia Idakiev
 
Building Reusable Custom Elements With Angular
Building Reusable Custom Elements With AngularBuilding Reusable Custom Elements With Angular
Building Reusable Custom Elements With Angular
Ilia Idakiev
 
State management for enterprise angular applications
State management for enterprise angular applicationsState management for enterprise angular applications
State management for enterprise angular applications
Ilia Idakiev
 
Offline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and ReactOffline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and React
Ilia Idakiev
 
Testing rx js using marbles within angular
Testing rx js using marbles within angularTesting rx js using marbles within angular
Testing rx js using marbles within angular
Ilia Idakiev
 
Predictable reactive state management for enterprise apps using NGRX/platform
Predictable reactive state management for enterprise apps using NGRX/platformPredictable reactive state management for enterprise apps using NGRX/platform
Predictable reactive state management for enterprise apps using NGRX/platform
Ilia Idakiev
 
Angular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of SpeedAngular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of Speed
Ilia Idakiev
 
Angular Offline Progressive Web Apps With NodeJS
Angular Offline Progressive Web Apps With NodeJSAngular Offline Progressive Web Apps With NodeJS
Angular Offline Progressive Web Apps With NodeJS
Ilia Idakiev
 
Introduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web ApplicationsIntroduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web Applications
Ilia Idakiev
 
Reflective injection using TypeScript
Reflective injection using TypeScriptReflective injection using TypeScript
Reflective injection using TypeScript
Ilia Idakiev
 
Zone.js
Zone.jsZone.js
Zone.js
Ilia Idakiev
 
Predictable reactive state management - ngrx
Predictable reactive state management - ngrxPredictable reactive state management - ngrx
Predictable reactive state management - ngrx
Ilia Idakiev
 

More from Ilia Idakiev (18)

Enterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platformEnterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platform
 
Deep Dive into Zone.JS
Deep Dive into Zone.JSDeep Dive into Zone.JS
Deep Dive into Zone.JS
 
RxJS Schedulers - Controlling Time
RxJS Schedulers - Controlling TimeRxJS Schedulers - Controlling Time
RxJS Schedulers - Controlling Time
 
Creating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-htmlCreating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-html
 
Marble Testing RxJS streams
Marble Testing RxJS streamsMarble Testing RxJS streams
Marble Testing RxJS streams
 
Deterministic JavaScript Applications
Deterministic JavaScript ApplicationsDeterministic JavaScript Applications
Deterministic JavaScript Applications
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components Everywhere
 
Building Reusable Custom Elements With Angular
Building Reusable Custom Elements With AngularBuilding Reusable Custom Elements With Angular
Building Reusable Custom Elements With Angular
 
State management for enterprise angular applications
State management for enterprise angular applicationsState management for enterprise angular applications
State management for enterprise angular applications
 
Offline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and ReactOffline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and React
 
Testing rx js using marbles within angular
Testing rx js using marbles within angularTesting rx js using marbles within angular
Testing rx js using marbles within angular
 
Predictable reactive state management for enterprise apps using NGRX/platform
Predictable reactive state management for enterprise apps using NGRX/platformPredictable reactive state management for enterprise apps using NGRX/platform
Predictable reactive state management for enterprise apps using NGRX/platform
 
Angular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of SpeedAngular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of Speed
 
Angular Offline Progressive Web Apps With NodeJS
Angular Offline Progressive Web Apps With NodeJSAngular Offline Progressive Web Apps With NodeJS
Angular Offline Progressive Web Apps With NodeJS
 
Introduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web ApplicationsIntroduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web Applications
 
Reflective injection using TypeScript
Reflective injection using TypeScriptReflective injection using TypeScript
Reflective injection using TypeScript
 
Zone.js
Zone.jsZone.js
Zone.js
 
Predictable reactive state management - ngrx
Predictable reactive state management - ngrxPredictable reactive state management - ngrx
Predictable reactive state management - ngrx
 

Recently uploaded

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

No More Promises! Let's RxJS!

  • 1. NO MORE PROMISES. LET'S RXJS REACTIVE EXTENSIONS FOR JAVASCRIPT
  • 2. A B O U T M E { "name": "Ilia Idakiev", "experience": [ “Google Developer Expert (GDE)“, "Developer & Co-founder @ HILLGRAND", "Lecturer in 'Advanced JS' @ Sofia University", "Contractor / Consultant", "Public / Private Courses” ], "involvedIn": [ "Angular Sofia", "SofiaJS / BeerJS", ] } !
  • 4. REACTIVE EXTENSIONS FOR JAVASCRIPT FUNCTIONAL PROGRAMMING ▸ Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. It is a declarative programming paradigm, which means programming is done with expressions or declarations instead of statements.
  • 5. REACTIVE EXTENSIONS FOR JAVASCRIPT IMPERATIVE VS DECLARATIVE PROGRAMMING function getAdmins(users) { const admins = []; for (let i = 0; i < users.length; i++) { const currentUser = users[i]; if (!currentUser.isAdmin) { continue; } admins.push(currentUser); } return admins; } Imperative programming focuses on describing how a program operates. function getAdmins(users) { return users.filter( currentUser => currentUser.isAdmin ); } Declarative programming focuses on expressing the logic of a computation without describing its control flow.
  • 6. REACTIVE EXTENSIONS FOR JAVASCRIPT FUNCTIONAL CONCEPTS ▸ Pure Functions ▸ Return the same value given the same arguments. ▸ Its evaluation has no side effects. ▸ Composition - pure functions can be composed. ▸ Immutability - don’t mutate state. ▸ Higher-order functions (Functions as first-class citizens) ▸ takes one or more functions as arguments.
 ▸ returns a function as its result. ▸ Currying and Partial Application - translating the evaluation of a function that takes multiple arguments into evaluating a sequence of functions. ▸ Lazy evaluation - evaluate when needed. and / or
  • 7. REACTIVE EXTENSIONS FOR JAVASCRIPT REFERENTIAL TRANSPARENCY ▸ An expression is called referentially transparent if it can be replaced with its corresponding value without changing the program's behaviour. This requires that the expression is pure, that is to say the expression value must be the same for the same inputs and its evaluation must have no side effects.
  • 8. REACTIVE EXTENSIONS FOR JAVASCRIPT FUNCTIONAL PROGRAMMING ADVANTAGES ▸ Clean Code - Easy to test, debug and reason about (no side effects). ▸ Modularity - Breaking large problems into small parts. ▸ Reusability - Pure functions can be reused and composed. ▸ Efficiency - Lazy Evaluation (evaluate when needed)
  • 10. REACTIVE EXTENSIONS FOR JAVASCRIPT ASYNCHRONOUS JAVASCRIPT ▸ Continuation Passing Style (CPS) ▸ CPS with named callbacks (to reduce callback hell) ▸ Futures and Promises / async - await ▸ Async data streams - RxJS
  • 12. REACTIVE EXTENSIONS FOR JAVASCRIPT ▸ Futures and promises originated in functional programming and related paradigms (such as logic programming) to decouple a value (a future) from how it was computed (a promise), allowing the computation to be done more flexibly, notably by parallelizing it. WHERE DO PROMISES COME FROM?
  • 13. REACTIVE EXTENSIONS FOR JAVASCRIPT ▸ A Promise is a proxy for a value not necessarily known when the promise is created. ▸ It allows you to associate handlers with an asynchronous action's eventual success value or failure reason. ▸ This lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a promise to supply the value at some point in the future. PROMISES
  • 14. REACTIVE EXTENSIONS FOR JAVASCRIPT ▸ Pending - initial state, neither fulfilled nor rejected. ▸ Fulfilled - the operation completed successfully. ▸ Rejected - the operation failed. PROMISE STATES (STATE MACHINE)
  • 15. REACTIVE EXTENSIONS FOR JAVASCRIPT PROMISE EXAMPLE const promise = new Promise(function (resolve, reject) { setTimeout(function () { const randomNumber = Math.floor(Math.random() * Math.floor(10)); if (randomNumber % 2 === 0) { resolve('Success'); return; } reject('Error'); }, 300); }); promise.then(console.log).catch(console.error); Controlling the machine state
  • 16. REACTIVE EXTENSIONS FOR JAVASCRIPT PROMISE EXAMPLE (2) Promise.resolve(10).then(x => x + 10).then(console.log);
  • 17. WAIT A MINUTE THIS LOOKS VERY SIMILAR TO…
  • 18. REACTIVE EXTENSIONS FOR JAVASCRIPT JS ARRAYS [10].map(x => x + 1).forEach(console.log);
  • 19. WHY IS IT CALLED MAP?
  • 21. REACTIVE EXTENSIONS FOR JAVASCRIPT ▸ Mathematical Abstractions - Helps us getting rid of details so we can look at things a different way. CATEGORY THEORY
  • 22. REACTIVE EXTENSIONS FOR JAVASCRIPT CATEGORIES ▸ A category consists of a collection of objects (just abstractions) and morphisms (functions).
 (X, Y, Z - objects) ▸ The morphisms must obey the following laws: ▸ They must me composable. ▸ Compositions must me associative. ▸ For each object a, there is an identity morphism.
  • 23. REACTIVE EXTENSIONS FOR JAVASCRIPT CATEGORY THEORY IN JAVASCRIPT add(1, 1) // > 2 - persists type add(1, 0) // > 1 - identity function add(1, 2) === add(2, 1) // > 3 - commutative add(add(1, 2), 3) === add(1, add(2, 3)); // > 6 - associative and composable multiply(2, add(3, 4)) === add(multiply(2, 3), multiply(2, 4)) // > 14 - distributive
  • 24. REACTIVE EXTENSIONS FOR JAVASCRIPT FUNCTORS ▸ A structure-preserving mapping between categories. ▸ Let A and B be categories. A functor F from A to B is a mapping that: ▸ associates to each object a in A an object F(a) in B. ▸ associates to each morphism f in A a morphism F(f) in B such that the following two conditions hold: ▸ F(ID(x)) = ID(F(X)) ▸ F(g o f) = F(f) o F(g) for all morphisms f: x -> y, g: y -> z in A.
  • 25. REACTIVE EXTENSIONS FOR JAVASCRIPT CATEGORY THEORY OBJECTS IN JAVASCRIPT const containerPrototype = { map: function (fn) { return Container(fn(this.value)); } } function Container(value) { return Object.create(containerPrototype, { value: { value } }); } console.log(Container(10).map(x => x + 100)); // > Container { value: 110 }
  • 26. REACTIVE EXTENSIONS FOR JAVASCRIPT CATEGORY THEORY OBJECTS IN JAVASCRIPT Container(10).map(x => x + 100).map(x => '' + x); // > Container { value: '110' }
  • 27. REACTIVE EXTENSIONS FOR JAVASCRIPT CATEGORY THEORY OBJECTS IN JAVASCRIPT [10].map(x => x + 100).map(x => '' + x);
  • 28. REACTIVE EXTENSIONS FOR JAVASCRIPT CATEGORY THEORY OBJECTS IN JAVASCRIPT [10].map(x => x + 100).map(x => '' + x); It’s a functor!
  • 30. REACTIVE EXTENSIONS FOR JAVASCRIPT PROMISE EXAMPLE (3) Promise.resolve(10).then(x => x + 100).then(x => '' + x); // > Promise { value: '110' }
  • 31. REACTIVE EXTENSIONS FOR JAVASCRIPT PROMISE EXAMPLE (4) Promise.resolve(10).then(x => Promise.resolve(x + 100)).then(x => '' + x); // > Promise { value: '110' }
  • 32. REACTIVE EXTENSIONS FOR JAVASCRIPT PROMISE EXAMPLE (4) Promise.resolve(10).then(x => Promise.resolve(x + 100)).then(x => '' + x); // > Promise { value: '110' } It’s flattening the structure! It’s not a functor!
  • 33. REACTIVE EXTENSIONS FOR JAVASCRIPT MONADS ▸ An extended functor. ▸ It can be used as container to wrap values. ▸ It can flatten the structure.
  • 34. WHY DO WE NEED MONADS AND FUNCTORS?
  • 35. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // Maybe { value: null } console.log(matchFirst('test', /rest/)); // Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
  • 36. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // Maybe { value: null } console.log(matchFirst('test', /rest/)); // Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
  • 37. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // Maybe { value: null } console.log(matchFirst('test', /rest/)); // Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
  • 38. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // Maybe { value: null } console.log(matchFirst('test', /rest/)); // Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
  • 39. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // Maybe { value: null } console.log(matchFirst('test', /rest/)); // Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
  • 40. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // > Maybe { value: null } console.log(matchFirst('test', /rest/)); // Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
  • 41. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // > Maybe { value: null } console.log(matchFirst('test', /rest/)); // > Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // Maybe { value: 'test1' }
  • 42. REACTIVE EXTENSIONS FOR JAVASCRIPT MAYBE FUNCTOR const maybePrototype = { map: function (fn) { return this.value !== null ? Maybe(fn(this.value)) : Maybe(null); } } function Maybe(value) { return Object.create(maybePrototype, { value: { value } }); } function matchFirst(string, regexp) { return Maybe(string).map(string => string.match(regexp)).map(matches => matches[0]); } console.log(matchFirst(null, /test/)); // > Maybe { value: null } console.log(matchFirst('test', /rest/)); // > Maybe { value: null } console.log(matchFirst('test1test2', /testd/)); // > Maybe { value: 'test1' }
  • 43. SO WHAT ABOUT RXJS?
  • 45. MARBLE TESTING RXJS STREAMS REACTIVE EXTENSIONS FOR JAVASCRIPT ▸ RxJS is a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code.
  • 46. REACTIVE EXTENSIONS FOR JAVASCRIPT CREATING AN OBSERVABLE (THE OLD WAY) import 'rxjs/add/observable/of'; import ‘rxjs/add/operator/map'; of(10).map(x => x + 100).map(x => '' + x).subscribe(console.log);
  • 47. REACTIVE EXTENSIONS FOR JAVASCRIPT CREATING AN OBSERVABLE import { of } from ‘rxjs'; import { map } from ‘rxjs/operators'; of(10).pipe(map(x => x + 100), map(x => '' + x)).subscribe(console.log);
  • 49. WHAT ARE THE DIFFERENCES RXJS AND PROMISES?
  • 50. REACTIVE EXTENSIONS FOR JAVASCRIPT CREATING AN OBSERVABLE STREAM (1) import { from } from ‘rxjs'; import { map } from ‘rxjs/operators'; const stream$ = from([1, 2, 3, 4]).pipe(map(x => x + 1)); stream$.subscribe(console.log) // > 2 // > 3 // > 4 // > 5
  • 51. REACTIVE EXTENSIONS FOR JAVASCRIPT CREATING AN OBSERVABLE STREAM (2) import { interval } from ‘rxjs'; import { publish } from ‘rxjs/operators’; const connectableTimer = interval(1000).pipe(publish()); connectableTimer.connect(); setTimeout(function () { connectableTimer.subscribe(console.log); // > 4 // > 5 // > 6 // > 7 // ... }, 5000)
  • 52. REACTIVE EXTENSIONS FOR JAVASCRIPT HOT AND COLD OBSERVABLES ▸ Cold - An observable is “cold” if its underlying producer is created and activated during subscription. ▸ Hot - An observable is “hot” if its underlying producer is either created or activated outside of subscription.
  • 53. 1. OBSERVABLES ARE STREAMS OF DATA(One or more values)
  • 55. REACTIVE EXTENSIONS FOR JAVASCRIPT COMMON THINGS THAT WE NEED ▸ debouncing ▸ cancelation ▸ retrying ▸ throttling ▸ timeouts ▸ detect only if something changed
  • 57. 2. BETTER FLOW CONTROL (using the rxjs operators and rxjs observable factories/combiners)
  • 58. 3. OBSERVABLES ARE CANCELLABLE (using unsubscribe)
  • 59. 4. OBSERVABLES ARE LAZY (we have to explicitly state that we want the observable to start)
  • 60. WHAT IS COMMON ABOUT RXJS AND PROMISES?
  • 61. MARBLE TESTING RXJS STREAMS WHAT IS COMMON ABOUT RXJS AND PROMISES? ▸ They are both monads. ▸ Both monads are used to capture the effect of latency.
  • 62. WHY ARE THEY REACTIVE?
  • 63. DEMO
  • 64. MARBLE TESTING RXJS STREAMS CONNECT GitHub > https://github.com/iliaidakiev (/slides/ - list of future and past events) Twitter > @ilia_idakiev