SlideShare a Scribd company logo
1 of 31
Download to read offline
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

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
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
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
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
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
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
 

Functional Reactive Programming avec RxSwift