SlideShare a Scribd company logo
Functional Reactive
Programming avec RxSwift
Cocoaheads Strasbourg Mai 2017
Nicolas VERINAUD
Freelance
Formateur
Développeur iOS depuis
2011
Prog. Fonctionnelle (yay
F# !)
Qui suis-je ?
@nverinaud
≠ OOP
Composition > Héritage
Fonctions en paramètre
(closures)
Immuabilité
Functional
Programming
Réagir aux changements d’états
Délégation
Closures
Notifications (😨)
KVO (🤢)
Reactive Programming
Réagir aux changements d’états
Délégation [implicite]
Closures [implicite]
Notifications (😨) [implicite]
KVO (🤢) [implicite]
Reactive Programming
“Explicit is better than implicit.”
–The Zen of Python
Observable<T>
Une valeur qui change
au cours du temps.
Observable<T>
Push
≠
Pull (Sequence)
Observable<T>
protocol Observable<T>
{
func subscribe(_ observer: Observer<T>)
-> Disposable
}
Observable<T>
protocol Observer<T>
{
func onNext(_ element: T)
func onError(_ error: Error)
func onCompleted()
}
Observable<T>
Observable<A> -> Observable<B>
Observable<String> -> Observable<Bool>
Observable<T>
How ?
Observable<A> -> Observable<B>
Observable<String> -> Observable<Bool>
Observable<T>
Avec map !
Monad in disguise…psshh
Observable<A> -> Observable<B>
Observable<String> -> Observable<Bool>
Observable<T>
func map(_ transform: (A -> B)) ->
Observable<B>
Observable<T>
// strings: Observable<String>
let isEmpty = strings.map { $0.isEmpty }
Observable<T>
Demo !
RxSwift
ou
ReactiveCocoa
?
RxSwift
👍 Respectueux des interfaces Rx
originales
👎 Pas de typage pour Error
ReactiveCocoa
👍 Typage de Error
👍 Distinction Hot et Cold
👎 Concepts ≠ Rx (Signal)
One more thing…
“No Silver Bullet”
–Fred Brooks
“Reactive is dead, long
live tasteful composition
of side effects.”
–Erik Meijer
One Many
Sync T Sequence
Async Future<T> Observable<T>
Tasteful Side Effects
Tasteful Side Effects
Future<Option<Array<String>>>
Result<Observable<String>>
etc…
Tasteful Side Effects
Future<Option<Array<String>>>
Result<Observable<String>>
etc…
Soyez explicites !
Aller plus loin…
ReactiveX.io
IntroToRx.com
React 2014 : Erik Meijer - What
does it mean to be Reactive?
Merci !
@nverinaud
n.verinaud@gmail.com
nverinaud.com
Bibliographie
Kaa - http://www.abadinte.com/wp-content/
uploads/2014/09/Kaa-aie-confiance.jpg
Fred Brooks Wikipedia - https://
fr.m.wikipedia.org/wiki/Frederick_Brooks
Erik Meijer Wikipedia - https://en.wikipedia.org/
wiki/Erik_Meijer_%28computer_scientist%29
React 2014 : Erik Meijer - What does it mean to
be Reactive?
Meme Generator - memegenerator.net

More Related Content

What's hot

Looping statement
Looping statementLooping statement
Looping statement
ilakkiya
 
Do...while loop structure
Do...while loop structureDo...while loop structure
Do...while loop structure
Jd Mercado
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPs
James Ward
 

What's hot (20)

L8
L8L8
L8
 
Introduction of Object Oriented JavaScript
Introduction of Object Oriented JavaScriptIntroduction of Object Oriented JavaScript
Introduction of Object Oriented JavaScript
 
Looping statement
Looping statementLooping statement
Looping statement
 
Hd10
Hd10Hd10
Hd10
 
Java loops
Java loopsJava loops
Java loops
 
Loops in R
Loops in RLoops in R
Loops in R
 
An introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptAn introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScript
 
Javascripts hidden treasures BY - https://geekyants.com/
Javascripts hidden treasures            BY  -  https://geekyants.com/Javascripts hidden treasures            BY  -  https://geekyants.com/
Javascripts hidden treasures BY - https://geekyants.com/
 
Kotlin Coroutines and Rx
Kotlin Coroutines and RxKotlin Coroutines and Rx
Kotlin Coroutines and Rx
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
Do...while loop structure
Do...while loop structureDo...while loop structure
Do...while loop structure
 
Introduction to Functional Programming (w/ JS)
Introduction to Functional Programming (w/ JS)Introduction to Functional Programming (w/ JS)
Introduction to Functional Programming (w/ JS)
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
C++ control loops
C++ control loopsC++ control loops
C++ control loops
 
Python loops
Python loopsPython loops
Python loops
 
Functions
FunctionsFunctions
Functions
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPs
 
Looping
LoopingLooping
Looping
 
The Loops
The LoopsThe Loops
The Loops
 
Kojak Metrics Explained
Kojak Metrics ExplainedKojak Metrics Explained
Kojak Metrics Explained
 

Similar to Functional Reactive Programming avec RxSwift

Reactive Extensions, Rx
Reactive Extensions, RxReactive Extensions, Rx
Reactive Extensions, Rx
Dima Pasko
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive Extensions
Kiev ALT.NET
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
jeffz
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)
jeffz
 
Introduction to Reactive Extensions
Introduction to Reactive ExtensionsIntroduction to Reactive Extensions
Introduction to Reactive Extensions
Peter Goodman
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event Systems
Leonardo Borges
 

Similar to Functional Reactive Programming avec RxSwift (20)

响应式编程及框架
响应式编程及框架响应式编程及框架
响应式编程及框架
 
Reactive Extensions, Rx
Reactive Extensions, RxReactive Extensions, Rx
Reactive Extensions, Rx
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive Extensions
 
Welcome to rx java2
Welcome to rx java2Welcome to rx java2
Welcome to rx java2
 
Functional Swift
Functional SwiftFunctional Swift
Functional Swift
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)
 
Elixir and OTP
Elixir and OTPElixir and OTP
Elixir and OTP
 
Javantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
Javantura v3 - Going Reactive with RxJava – Hrvoje CrnjakJavantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
Javantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
 
Reactive Thinking in iOS Development - Pedro Piñera Buendía - Codemotion Amst...
Reactive Thinking in iOS Development - Pedro Piñera Buendía - Codemotion Amst...Reactive Thinking in iOS Development - Pedro Piñera Buendía - Codemotion Amst...
Reactive Thinking in iOS Development - Pedro Piñera Buendía - Codemotion Amst...
 
Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)
 
Frege Tutorial at JavaOne 2015
Frege Tutorial at JavaOne 2015Frege Tutorial at JavaOne 2015
Frege Tutorial at JavaOne 2015
 
Introduction to Reactive Extensions
Introduction to Reactive ExtensionsIntroduction to Reactive Extensions
Introduction to Reactive Extensions
 
Introduction to Reactive Extensions
Introduction to Reactive ExtensionsIntroduction to Reactive Extensions
Introduction to Reactive Extensions
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
 
The Sincerest Form of Flattery
The Sincerest Form of FlatteryThe Sincerest Form of Flattery
The Sincerest Form of Flattery
 
Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event Systems
 
Functional programming in clojure
Functional programming in clojureFunctional programming in clojure
Functional programming in clojure
 
Getting property based testing to work after struggling for 3 years
Getting property based testing to work after struggling for 3 yearsGetting property based testing to work after struggling for 3 years
Getting property based testing to work after struggling for 3 years
 

More from Nicolas VERINAUD

More from Nicolas VERINAUD (7)

Architecture Émergente Guidée Par Les Tests - Cocoaheads Nantes Novembre 2019
Architecture Émergente Guidée Par Les Tests - Cocoaheads Nantes Novembre 2019Architecture Émergente Guidée Par Les Tests - Cocoaheads Nantes Novembre 2019
Architecture Émergente Guidée Par Les Tests - Cocoaheads Nantes Novembre 2019
 
Du Code & Des Humains - ElsassJUG 2018
Du Code & Des Humains - ElsassJUG 2018Du Code & Des Humains - ElsassJUG 2018
Du Code & Des Humains - ElsassJUG 2018
 
Du Code & Des Humains - Agile Tour Strasbourg 2017
Du Code & Des Humains - Agile Tour Strasbourg 2017Du Code & Des Humains - Agile Tour Strasbourg 2017
Du Code & Des Humains - Agile Tour Strasbourg 2017
 
Du Code & Des Humains
Du Code & Des HumainsDu Code & Des Humains
Du Code & Des Humains
 
Les Code Reviews : le guide de survie
Les Code Reviews : le guide de survieLes Code Reviews : le guide de survie
Les Code Reviews : le guide de survie
 
Coder F#nctionnel
Coder F#nctionnelCoder F#nctionnel
Coder F#nctionnel
 
SUPINFO Mobile Dev Talks - iOS
SUPINFO Mobile Dev Talks - iOSSUPINFO Mobile Dev Talks - iOS
SUPINFO Mobile Dev Talks - iOS
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 

Functional Reactive Programming avec RxSwift