Slide 1

Slide 1 text

Learn how to build Functional Reactive Applications with Elm, Node.js and Infinispan Galder Zamarreño Arrizabalaga 28th October 2016

Slide 2

Slide 2 text

Moi • @ • Infinispan developer & co-founder • Polyglot programmer • Functional programming @galderz

Slide 3

Slide 3 text

Learn How To Build Functional Reactive Apps

Slide 4

Slide 4 text

Functional reactive apps Apps constructed using Functional Reactive Programming (FRP) principles

Slide 5

Slide 5 text

Functional Reactive Programming is Abstract

Slide 6

Slide 6 text

defining FRP • What is FRP? • Definition • Why is FRP interesting? • Usefulness

Slide 7

Slide 7 text

what is FRP? Composable, declarative way of programming with values changing over time

Slide 8

Slide 8 text

functional input => combinators => output

Slide 9

Slide 9 text

Functional + Reactive event + state => transform => state and/or event

Slide 10

Slide 10 text

Why is FRP interesting? Composability: easier to reason Asynchronous by default Efficiency++

Slide 11

Slide 11 text

how to build frp apps? HTTP TCP/IP

Slide 12

Slide 12 text

Elm HTTP TCP/IP statically compiled

Slide 13

Slide 13 text

Elm HTTP TCP/IP statically compiled building web user interfaces

Slide 14

Slide 14 text

Elm HTTP TCP/IP statically compiled building web user interfaces promotes FRP

Slide 15

Slide 15 text

Elm HTTP TCP/IP statically compiled building web user interfaces promotes FRP compiles to fast Javascript

Slide 16

Slide 16 text

Elm HTTP TCP/IP statically compiled building web user interfaces promotes FRP compiles to fast Javascript most helpful compiler

Slide 17

Slide 17 text

Elm HTTP TCP/IP statically compiled building web user interfaces promotes FRP compiles to fast Javascript most helpful compiler no runtime exceptions

Slide 18

Slide 18 text

Node.js HTTP TCP/IP based on express.js

Slide 19

Slide 19 text

Node.js HTTP TCP/IP based on express.js FRP friendly (async, events)

Slide 20

Slide 20 text

Node.js HTTP TCP/IP based on express.js FRP friendly (async, events) stateless, listens on port 3000

Slide 21

Slide 21 text

Node.js HTTP TCP/IP based on express.js FRP friendly (async, events) stateless, listens on port 3000 talks binary to data grid

Slide 22

Slide 22 text

infinispan HTTP TCP/IP in- memory data grid

Slide 23

Slide 23 text

infinispan HTTP TCP/IP in- memory data grid 3 server node domain

Slide 24

Slide 24 text

infinispan HTTP TCP/IP in- memory data grid 3 server node domain 2 copies redundant

Slide 25

Slide 25 text

infinispan HTTP TCP/IP in- memory data grid 3 server node domain 2 copies redundant Java, Node.js, C/C++... clients

Slide 26

Slide 26 text

infinispan HTTP TCP/IP in- memory data grid 3 server node domain 2 copies redundant Java, Node.js, C/C++... clients remote event listeners

Slide 27

Slide 27 text

Elm Architecture Elm Runtime Model Html + Msg (Click) update Msg (Click) + Model Cmd e.g. http call … Msg (Http Resp) + Model Model updated Model view … button click …

Slide 28

Slide 28 text

Demo: Fetch Talks (1) GET /events

Slide 29

Slide 29 text

Demo: fetch Talks (2) GET /events iterate event 1 event 2 …

Slide 30

Slide 30 text

Demo: fetch Talks (3) GET /events iterate event 1 event 2 … JSON event[]

Slide 31

Slide 31 text

Demo: Fetch Talks

Slide 32

Slide 32 text

Demo: insert Talk (1) POST /events

Slide 33

Slide 33 text

demo: insert Talk (2) POST /events putIfAbsent

Slide 34

Slide 34 text

demo: insert Talk (3) POST /events putIfAbsent true/false created event

Slide 35

Slide 35 text

demo: insert Talk (4) POST /events putIfAbsent true/false created event JSON true/false WS: JSON event WS: JSON event

Slide 36

Slide 36 text

demo: insert Talk

Slide 37

Slide 37 text

demo: Search Talks (1) GET /search ?q=query

Slide 38

Slide 38 text

demo: Search Talks (2) execute GET /search ?q=query

Slide 39

Slide 39 text

demo: search Talks (3) execute results JSON results GET /search ?q=query

Slide 40

Slide 40 text

demo: search Talks

Slide 41

Slide 41 text

Learn How To Build Functional Reactive Apps what is FRP

Slide 42

Slide 42 text

Learn How To Build Functional Reactive Apps what is FRP why FRP is useful

Slide 43

Slide 43 text

Learn How To Build Functional Reactive Apps what is FRP why FRP is useful how to build an FR app

Slide 44

Slide 44 text

Learn How To Build Functional Reactive Apps what is FRP why FRP is useful how to build an FR app live coding an FR app

Slide 45

Slide 45 text

credits Approve by Aha-Soft from the Noun Project Window by Oleg Frolov from the Noun Project Server Error by Montu Yadav from the Noun Project Databases by Oliviu Stoian from the Noun Project

Slide 46

Slide 46 text

demo link github.com/galderz/ infinispan-events/tree/late16

Slide 47

Slide 47 text

Thanks • elm-lang.org • infinispan.org • redhat.com/en/technologies/ jboss-middleware/data-grid