SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
Functional Reactive Programming 
with Ractive.js
Functional Reactive Programming 
with Ractive.js 
Architecture 
agnostic 
Why Ractive? 
o Created at theguardian.com 
o Mustache templates 
o POJO data binding, event proxies 
o Animations, transitions, SVG, Promise/A+ 
o Partials, components, plugins 
o Interactive tutorials
Functional Reactive Programming 
with Ractive.js 
What is Functional Reactive Programming? 
1. FRP is programming with async data streams 
2. Everything is a stream
Functional Reactive Programming 
with Ractive.js 
Two kinds of asynchronism? 
o Defective async: I/O 
o Natural async: Events 
Network lags, etc... 
Users are free to choose 
when to click a button
Functional Reactive Programming 
with Ractive.js 
When we embrace async programming, 
events are the same as other async 
streams. 
We can merge async streams from 
different sources: events, promises... 
Reactive Extensions: 
Observable interface
Functional Reactive Programming 
with Ractive.js
Functional Reactive Programming 
with Ractive.js 
Example 
Implement a Twitter-like “Who to follow” 
suggestion box for GitHub users 
Adapted from André Staltz 
introduction to FRP
Template 
Pass index to event handlers 
Declare event proxy sources 
in HTML code
Ractive-RxJS bridge & utility 
There are also Ractive adaptors 
for RxJS and Bacon.js
Initialize Ractive 
Element container 
Template 
Data
Refresh event stream 
Es6 arrow functions 
for simplicity 
Think sequantially! 
flatMap === map to another 
stream/Observable
Close event stream 
We don’t care 
where this is coming from 
(declared in HTML) 
The Ractive event 
contains the index value
And that’s all! 
Thanks for your attention! 
I hope this gives you some inspiration
Functional Reactive Programming 
with Ractive.js 
References 
Source code 
Video of talk (Spanish) 
Original example source 
André Staltz intro to RsJX 
Ractive.js homepage 
Reactive Extensions: RxJS
Functional Reactive Programming 
with Ractive.js 
I’m a collaborator of the FunScript project 
(F# to JS compiler), if you’re interested in 
functional programming you may want to check it 
funscript.info/ 
github.com/alfonsogarciacaro 
meetup.com/madrid-fsharp/ 
@alfonsogcnunez 
tiny

Más contenido relacionado

La actualidad más candente

Utilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR ProblemUtilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR Problem
Guo Albert
 
Why should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming ParadigmWhy should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming Paradigm
Tech Triveni
 
Net framework
Net frameworkNet framework
Net framework
Tuan Ngo
 

La actualidad más candente (19)

Using f# project from c#
Using f# project from c#Using f# project from c#
Using f# project from c#
 
Utilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR ProblemUtilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR Problem
 
How to GraphQL
How to GraphQLHow to GraphQL
How to GraphQL
 
Social connections14: Super charge your API’s with Reactive streams
Social connections14: Super charge your API’s with Reactive streamsSocial connections14: Super charge your API’s with Reactive streams
Social connections14: Super charge your API’s with Reactive streams
 
Why should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming ParadigmWhy should a Java programmer shifts towards Functional Programming Paradigm
Why should a Java programmer shifts towards Functional Programming Paradigm
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional way
 
Kotlin & arrow: the functional way
Kotlin & arrow:  the functional wayKotlin & arrow:  the functional way
Kotlin & arrow: the functional way
 
Building Real-Time Search at MailChimp
Building Real-Time Search at MailChimpBuilding Real-Time Search at MailChimp
Building Real-Time Search at MailChimp
 
Sprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdfSprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdf
 
Applied Design Patterns - A Compiler Case Study
Applied Design Patterns - A Compiler Case StudyApplied Design Patterns - A Compiler Case Study
Applied Design Patterns - A Compiler Case Study
 
Seminar globalize3 - DungNV
Seminar globalize3 - DungNVSeminar globalize3 - DungNV
Seminar globalize3 - DungNV
 
Academy PRO: React JS. Typescript
Academy PRO: React JS. TypescriptAcademy PRO: React JS. Typescript
Academy PRO: React JS. Typescript
 
Clean Architecture in Android. UPTech TechTalk
Clean Architecture in Android. UPTech TechTalkClean Architecture in Android. UPTech TechTalk
Clean Architecture in Android. UPTech TechTalk
 
ISI work
ISI workISI work
ISI work
 
Apache Beam: Lote portátil y procesamiento de transmisión
Apache Beam: Lote portátil y procesamiento de transmisiónApache Beam: Lote portátil y procesamiento de transmisión
Apache Beam: Lote portátil y procesamiento de transmisión
 
GraphQL Will Do To REST What JSON Did To XML
GraphQL Will Do To REST What JSON Did To XMLGraphQL Will Do To REST What JSON Did To XML
GraphQL Will Do To REST What JSON Did To XML
 
Net framework
Net frameworkNet framework
Net framework
 
GraphQL Meetup Bangkok 3.0
GraphQL Meetup Bangkok 3.0GraphQL Meetup Bangkok 3.0
GraphQL Meetup Bangkok 3.0
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 

Destacado

ReactiveX-SEA
ReactiveX-SEAReactiveX-SEA
ReactiveX-SEA
Yang Yang
 

Destacado (19)

RiotJS - an overview
RiotJS - an overview RiotJS - an overview
RiotJS - an overview
 
ReactiveX-SEA
ReactiveX-SEAReactiveX-SEA
ReactiveX-SEA
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Programação reativa com RxJS e Angular
Programação reativa com RxJS e AngularProgramação reativa com RxJS e Angular
Programação reativa com RxJS e Angular
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJS
 
Reactive programming
Reactive programmingReactive programming
Reactive programming
 
RxJS Evolved
RxJS EvolvedRxJS Evolved
RxJS Evolved
 
RxJS - The Reactive extensions for JavaScript
RxJS - The Reactive extensions for JavaScriptRxJS - The Reactive extensions for JavaScript
RxJS - The Reactive extensions for JavaScript
 
Functional Reactive Angular 2
Functional Reactive Angular 2 Functional Reactive Angular 2
Functional Reactive Angular 2
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
 
Rxjs ppt
Rxjs pptRxjs ppt
Rxjs ppt
 
Reactive Extensions for JavaScript
Reactive Extensions for JavaScriptReactive Extensions for JavaScript
Reactive Extensions for JavaScript
 
Reactive Programming and RxJS
Reactive Programming and RxJSReactive Programming and RxJS
Reactive Programming and RxJS
 
RxJS - The Reactive Extensions for JavaScript
RxJS - The Reactive Extensions for JavaScriptRxJS - The Reactive Extensions for JavaScript
RxJS - The Reactive Extensions for JavaScript
 
RxJS In-Depth - AngularConnect 2015
RxJS In-Depth - AngularConnect 2015RxJS In-Depth - AngularConnect 2015
RxJS In-Depth - AngularConnect 2015
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
 
Infografía Obs cetelem_Consumo_Europa_2016
Infografía Obs cetelem_Consumo_Europa_2016Infografía Obs cetelem_Consumo_Europa_2016
Infografía Obs cetelem_Consumo_Europa_2016
 

Similar a FRP with Ractive and RxJS

Open innovation in software means Open Source (2011 remix)
Open innovation in software means Open Source (2011 remix)Open innovation in software means Open Source (2011 remix)
Open innovation in software means Open Source (2011 remix)
Bertrand Delacretaz
 
JavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin GermanJavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin German
Adam Boczek
 

Similar a FRP with Ractive and RxJS (20)

PHP Reactive Programming at Medan Tech Day 2018
PHP Reactive Programming at Medan Tech Day 2018PHP Reactive Programming at Medan Tech Day 2018
PHP Reactive Programming at Medan Tech Day 2018
 
Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)
 
Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJava
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond Rx
 
Web Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptxWeb Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptx
 
Spsmi13 charts
Spsmi13 chartsSpsmi13 charts
Spsmi13 charts
 
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdfReact Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
Real world functional reactive programming
Real world functional reactive programmingReal world functional reactive programming
Real world functional reactive programming
 
RxJs
RxJsRxJs
RxJs
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018
 
Open innovation in software means Open Source (2011 remix)
Open innovation in software means Open Source (2011 remix)Open innovation in software means Open Source (2011 remix)
Open innovation in software means Open Source (2011 remix)
 
"React Native" by Vanessa Leo e Roberto Brogi
"React Native" by Vanessa Leo e Roberto Brogi "React Native" by Vanessa Leo e Roberto Brogi
"React Native" by Vanessa Leo e Roberto Brogi
 
My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017
My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017
My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017
 
Open Event API
Open Event APIOpen Event API
Open Event API
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
FraSCAti Adaptive and Reflective Middleware of Middleware
FraSCAti Adaptive and Reflective Middleware of MiddlewareFraSCAti Adaptive and Reflective Middleware of Middleware
FraSCAti Adaptive and Reflective Middleware of Middleware
 
Creating a simple doodle (drawing) like application using silverlight and rea...
Creating a simple doodle (drawing) like application using silverlight and rea...Creating a simple doodle (drawing) like application using silverlight and rea...
Creating a simple doodle (drawing) like application using silverlight and rea...
 
JavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin GermanJavaScript & Enterprise BED-Con 2014 Berlin German
JavaScript & Enterprise BED-Con 2014 Berlin German
 

Más de Alfonso Garcia-Caro (6)

F# for Scala developers
F# for Scala developersF# for Scala developers
F# for Scala developers
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#
 
Madrid .NET Meetup: Microsoft open sources .NET!
Madrid .NET Meetup: Microsoft open sources .NET!Madrid .NET Meetup: Microsoft open sources .NET!
Madrid .NET Meetup: Microsoft open sources .NET!
 
Madrid F# Meetup: Introduction to F#
Madrid F# Meetup: Introduction to F#Madrid F# Meetup: Introduction to F#
Madrid F# Meetup: Introduction to F#
 
FunScript:F#からJavaScriptへのコンパイラー
FunScript:F#からJavaScriptへのコンパイラーFunScript:F#からJavaScriptへのコンパイラー
FunScript:F#からJavaScriptへのコンパイラー
 
FunScript: Why bother?
FunScript: Why bother?FunScript: Why bother?
FunScript: Why bother?
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

FRP with Ractive and RxJS

  • 2. Functional Reactive Programming with Ractive.js Architecture agnostic Why Ractive? o Created at theguardian.com o Mustache templates o POJO data binding, event proxies o Animations, transitions, SVG, Promise/A+ o Partials, components, plugins o Interactive tutorials
  • 3. Functional Reactive Programming with Ractive.js What is Functional Reactive Programming? 1. FRP is programming with async data streams 2. Everything is a stream
  • 4. Functional Reactive Programming with Ractive.js Two kinds of asynchronism? o Defective async: I/O o Natural async: Events Network lags, etc... Users are free to choose when to click a button
  • 5. Functional Reactive Programming with Ractive.js When we embrace async programming, events are the same as other async streams. We can merge async streams from different sources: events, promises... Reactive Extensions: Observable interface
  • 7. Functional Reactive Programming with Ractive.js Example Implement a Twitter-like “Who to follow” suggestion box for GitHub users Adapted from André Staltz introduction to FRP
  • 8. Template Pass index to event handlers Declare event proxy sources in HTML code
  • 9. Ractive-RxJS bridge & utility There are also Ractive adaptors for RxJS and Bacon.js
  • 10. Initialize Ractive Element container Template Data
  • 11. Refresh event stream Es6 arrow functions for simplicity Think sequantially! flatMap === map to another stream/Observable
  • 12. Close event stream We don’t care where this is coming from (declared in HTML) The Ractive event contains the index value
  • 13. And that’s all! Thanks for your attention! I hope this gives you some inspiration
  • 14. Functional Reactive Programming with Ractive.js References Source code Video of talk (Spanish) Original example source André Staltz intro to RsJX Ractive.js homepage Reactive Extensions: RxJS
  • 15. Functional Reactive Programming with Ractive.js I’m a collaborator of the FunScript project (F# to JS compiler), if you’re interested in functional programming you may want to check it funscript.info/ github.com/alfonsogarciacaro meetup.com/madrid-fsharp/ @alfonsogcnunez tiny