SlideShare a Scribd company logo
1 of 34
Download to read offline
PEMROGRAMAN REAKTIF 
FUNGSIONAL 
MENGGUNAKAN REACTIVECOCOA
TENTANG SAYA 
Coding sudah 8 tahun. 
6 tahun terakhir memimpin tim. 
Co-founder OneBit, 5x bikin startup 2 yg berhasil 
Pernah kerja di  BlackBerry 
   
 REACTIVECOCOA 
Adalah kerangka kerja untuk pemrograman reaktif fungsional 
Menyediakan APA (Antarmuka Pemrograman Aplikasi) untuk 
mengkomposisi dan mentransformasi aliran dari suatu nilai
SAPARATOZ!
 REACTIVECOCOA 
A framework for Functional Reactive Programming. Providing 
API for composing and transforming stream of values
WAIT, WHAT?
PEMROGRAMAN IMPERATIF 
int x = 5; 
int y = 3; int z = 2; z = x + y; // z = ? 
y = 2; 
NSLog("%@", z); // ?
PEMROGRAMAN IMPERATIF 
int x = 5; 
int y = 3; int z = 2; z = x + y; // z = ? 
y = 2; 
NSLog("%@", z); // ?
PEMROGRAMAN DEKLARATIF 
Pengembang menyatakan masalah secara deklaratif 
Fokusnya BUKAN di State 
Data Flow and Propagation of Change
PEMROGRAMAN FUNGSIONAL  
SALAH SATU CARA MEMROGRAM SECARA DEKLARATIF 
Ciri-Cirinya adalah mengurangi state dan mutable data 
Seperti fungsi matematika biasa. 
[  G 	Y
 Z
  Y
Z 
Y  
 Z   [   
Y   [
PEMROGRAMAN REAKTIF  
Dynamically links the program behaviour to its continuosly updating 
data stream 
Contoh paling jelas : Spreadsheet
FUNGSIONAL + REAKTIF = ?? 
links functions that observe continuous and dynamic streams of data 
(inputs) to the program behaviour (outputs) in real time
 REACTIVECOCOA 
Adalah kerangka kerja untuk pemrograman reaktif fungsional 
Menyediakan APA (Antarmuka Pemrograman Aplikasi) untuk 
mengkomposisi dan mentransformasi aliran dari suatu nilai
REACTIVECOCOA 
Memfasilitasi FRP di Objective-C
SEQUENCE 
Pull-Driven
SIGNAL 
Push-Driven
SIGNAL 
Push-Driven
STREAM TRANSFORMATION 

MAP 
RACSequence *squared = [numbers.rac_sequence 
map: ^id(NSNumber *number) { 
return @([number intValue] * [number intValue]) 
}];
MAP VS FOR 
RACSequence *squared = [numbers.rac_sequence 
map: ^id(NSNumber *number) { 
return @([number intValue] * [number intValue]) 
}]; 
NSArray *numbers = @[@4, @5, @6]; 
NSMutableArray *mutableNums = [numbers mutableCopy]; 
for (NSNumber *number in numbers) { 
[mutableNums addObject:@([number intValue] 
* [number intValue])]; 
}
FLATMAP
FILTER 
RACSequence *evenNums = [numbers.rac_sequence 
filter: ^BOOL(NSNumber *number) { 
return @( [number intValue] % 2 == 0); 
}];
FOLD / REDUCE 
RACSequence *products = [numbers.rac_sequence 
foldLeftWithStart:@1 
reduce:^id( id accumulator, id value) { 
return @([accumulator intValue] * [value intValue]); 
}];
COMBINELATEST / REDUCE
APPLYING TO AN APP 
STUDY CASE? FORM VALIDATION
THE USUAL WAY 
- (BOOL) isFormValid 
{ 
return (self.userNameField.text.length  0  
self.emailField.text.length  8  
self.passwordField.text.length  8  
[self.passwordField.text 
isEqual:self.passwordVerifyField.text]); 
} .... 
.... 
.... 
// Kode di atas berada nun jauh di sana 
#pragma mark - UITextFieldDelegate 
- (BOOL) textField: (UITextField *) textField 
shouldChangeCharactersInRange: (NSRange) range 
replacementString: (NSString*) string 
{ 
self.submitButton.enabled = [self isFormValid] 
return YES; 
}
JSON Call? 
Activity Indicator? 
Button Disable selama JSON Call 
dst dsb dkk dll...
RAC WAY 
RAC(self.submitButton, enabled) = 
[RACSignal combineLatest: @[ 
self.userNameField.rac_textSignal, self.emailField.rac_textSignal, 
self.passwordField.rac_textSignal, self.passwordField.rac_textSignal] 
reduce: ^(NSString *userName, NSString *email, 
NSString *password, NSString *ver) 
{ 
return @(userName.length  0  email.length  8  
password.length  8  
[password isEqual:ver]); 
}]; 
Menyatakan SEPERTI APA hubungannya secara deklaratif
DEMO / PRACTISE
SELANJUTNYA... MVC? 
Cek Ray Wenderlich Tutorial tentang MVVM
 REACTIVECOCOA 
Pembuatan aplikasi lebih fokus ke data + UX 
Mengurangi kompleksitas aplikasi, karena mengurangi peran 
'state' 
Kode yang terelasi, lebih dekat 
Kode lebih bisa ditest (dengan MVVM, cek raywenderlich)
 TAPI... 
Paradigma Baru dalam memrogram. 
Modal bikin iOS app sudah mahal, ditambah Cocoa/Cocoa 
Touch, tambah ReactiveCocoa 
Buatan  bukan  
ReactiveSwift masih dalam tahap pengembangan, Oktober 
direncanakan rilis

More Related Content

What's hot

Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C ProgrammingShuvongkor Barman
 
predefined and user defined functions
predefined and user defined functionspredefined and user defined functions
predefined and user defined functionsSwapnil Yadav
 
User defined Functions in MATLAB Part 1
User defined Functions in MATLAB Part 1User defined Functions in MATLAB Part 1
User defined Functions in MATLAB Part 1Shameer Ahmed Koya
 
INLINE FUNCTION IN C++
INLINE FUNCTION IN C++INLINE FUNCTION IN C++
INLINE FUNCTION IN C++Vraj Patel
 
functions in C and types
functions in C and typesfunctions in C and types
functions in C and typesmubashir farooq
 
M11 operator overloading and type conversion
M11 operator overloading and type conversionM11 operator overloading and type conversion
M11 operator overloading and type conversionNabeelaNousheen
 
Function in c program
Function in c programFunction in c program
Function in c programumesh patil
 
Functions in C++
Functions in C++Functions in C++
Functions in C++home
 
C programming language working with functions 1
C programming language working with functions 1C programming language working with functions 1
C programming language working with functions 1Jeevan Raj
 
Functions in C - Programming
Functions in C - Programming Functions in C - Programming
Functions in C - Programming GaurangVishnoi
 
Prsentation on functions
Prsentation on functionsPrsentation on functions
Prsentation on functionsAlisha Korpal
 

What's hot (20)

Functions in C++
Functions in C++Functions in C++
Functions in C++
 
4. function
4. function4. function
4. function
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
User Defined Functions
User Defined FunctionsUser Defined Functions
User Defined Functions
 
predefined and user defined functions
predefined and user defined functionspredefined and user defined functions
predefined and user defined functions
 
User defined Functions in MATLAB Part 1
User defined Functions in MATLAB Part 1User defined Functions in MATLAB Part 1
User defined Functions in MATLAB Part 1
 
Built in function
Built in functionBuilt in function
Built in function
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
C functions
C functionsC functions
C functions
 
INLINE FUNCTION IN C++
INLINE FUNCTION IN C++INLINE FUNCTION IN C++
INLINE FUNCTION IN C++
 
functions in C and types
functions in C and typesfunctions in C and types
functions in C and types
 
Procedure n functions
Procedure n functionsProcedure n functions
Procedure n functions
 
M11 operator overloading and type conversion
M11 operator overloading and type conversionM11 operator overloading and type conversion
M11 operator overloading and type conversion
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
C programming language working with functions 1
C programming language working with functions 1C programming language working with functions 1
C programming language working with functions 1
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
user defined function
user defined functionuser defined function
user defined function
 
Functions in C - Programming
Functions in C - Programming Functions in C - Programming
Functions in C - Programming
 
Prsentation on functions
Prsentation on functionsPrsentation on functions
Prsentation on functions
 

Similar to Functional Reactive Programming dengan ReactiveCocoa

Reactive cocoa cocoaheadsbe_2014
Reactive cocoa cocoaheadsbe_2014Reactive cocoa cocoaheadsbe_2014
Reactive cocoa cocoaheadsbe_2014Werner Ramaekers
 
react-hooks.pdf
react-hooks.pdfreact-hooks.pdf
react-hooks.pdfchengbo xu
 
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"Lviv Startup Club
 
Reactive cocoa
Reactive cocoaReactive cocoa
Reactive cocoaiacisclo
 
Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React NativePieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Nativetlv-ios-dev
 
Learn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodLearn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodJason Larsen
 
ReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of IIReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of IImanuelmaly
 
Presentation - Course about JavaFX
Presentation - Course about JavaFXPresentation - Course about JavaFX
Presentation - Course about JavaFXTom Mix Petreca
 
The Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideThe Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideStephen Chin
 
Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012hwilming
 
A Blueprint for Scala Microservices
A Blueprint for Scala MicroservicesA Blueprint for Scala Microservices
A Blueprint for Scala MicroservicesFederico Feroldi
 
Reactive cocoa made Simple with Swift
Reactive cocoa made Simple with SwiftReactive cocoa made Simple with Swift
Reactive cocoa made Simple with SwiftColin Eberhardt
 
Introduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoaIntroduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoaFlorent Pillet
 
What's new in c# 5.0 net ponto
What's new in c# 5.0   net pontoWhat's new in c# 5.0   net ponto
What's new in c# 5.0 net pontoPaulo Morgado
 
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 frameworkNikos 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 - Functional reactive UI framework (Nikos Kalogridis)GreeceJS
 

Similar to Functional Reactive Programming dengan ReactiveCocoa (20)

Reactive cocoa cocoaheadsbe_2014
Reactive cocoa cocoaheadsbe_2014Reactive cocoa cocoaheadsbe_2014
Reactive cocoa cocoaheadsbe_2014
 
Reactive Cocoa
Reactive CocoaReactive Cocoa
Reactive Cocoa
 
react-hooks.pdf
react-hooks.pdfreact-hooks.pdf
react-hooks.pdf
 
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
 
Reactive cocoa
Reactive cocoaReactive cocoa
Reactive cocoa
 
Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React NativePieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Native
 
Learn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodLearn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great Good
 
ReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of IIReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of II
 
Presentation - Course about JavaFX
Presentation - Course about JavaFXPresentation - Course about JavaFX
Presentation - Course about JavaFX
 
Chapter09
Chapter09Chapter09
Chapter09
 
Java beans
Java beansJava beans
Java beans
 
The Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideThe Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S Guide
 
Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012
 
A Blueprint for Scala Microservices
A Blueprint for Scala MicroservicesA Blueprint for Scala Microservices
A Blueprint for Scala Microservices
 
Jsf intro
Jsf introJsf intro
Jsf intro
 
Reactive cocoa made Simple with Swift
Reactive cocoa made Simple with SwiftReactive cocoa made Simple with Swift
Reactive cocoa made Simple with Swift
 
Introduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoaIntroduction to reactive programming & ReactiveCocoa
Introduction to reactive programming & ReactiveCocoa
 
What's new in c# 5.0 net ponto
What's new in c# 5.0   net pontoWhat's new in c# 5.0   net ponto
What's new in c# 5.0 net ponto
 
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
 
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)
 

Recently uploaded

Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Krijn Poppe
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxFamilyWorshipCenterD
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...NETWAYS
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Salam Al-Karadaghi
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringSebastiano Panichella
 
Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxaryanv1753
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationNathan Young
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Pooja Nehwal
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxJohnree4
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...NETWAYS
 
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...NETWAYS
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...NETWAYS
 
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)Basil Achie
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSebastiano Panichella
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@vikas rana
 
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...NETWAYS
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...marjmae69
 
Philippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptPhilippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptssuser319dad
 

Recently uploaded (20)

Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software Engineering
 
Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptx
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism Presentation
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptx
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
 
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
 
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation Track
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@
 
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
 
Philippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptPhilippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.ppt
 

Functional Reactive Programming dengan ReactiveCocoa

  • 1. PEMROGRAMAN REAKTIF FUNGSIONAL MENGGUNAKAN REACTIVECOCOA
  • 2. TENTANG SAYA Coding sudah 8 tahun. 6 tahun terakhir memimpin tim. Co-founder OneBit, 5x bikin startup 2 yg berhasil Pernah kerja di  BlackBerry    
  • 3.  REACTIVECOCOA Adalah kerangka kerja untuk pemrograman reaktif fungsional Menyediakan APA (Antarmuka Pemrograman Aplikasi) untuk mengkomposisi dan mentransformasi aliran dari suatu nilai
  • 5.  REACTIVECOCOA A framework for Functional Reactive Programming. Providing API for composing and transforming stream of values
  • 7. PEMROGRAMAN IMPERATIF int x = 5; int y = 3; int z = 2; z = x + y; // z = ? y = 2; NSLog("%@", z); // ?
  • 8. PEMROGRAMAN IMPERATIF int x = 5; int y = 3; int z = 2; z = x + y; // z = ? y = 2; NSLog("%@", z); // ?
  • 9. PEMROGRAMAN DEKLARATIF Pengembang menyatakan masalah secara deklaratif Fokusnya BUKAN di State Data Flow and Propagation of Change
  • 10. PEMROGRAMAN FUNGSIONAL  SALAH SATU CARA MEMROGRAM SECARA DEKLARATIF Ciri-Cirinya adalah mengurangi state dan mutable data Seperti fungsi matematika biasa. [ G Y Z Y
  • 11. Z Y Z [ Y [
  • 12. PEMROGRAMAN REAKTIF  Dynamically links the program behaviour to its continuosly updating data stream Contoh paling jelas : Spreadsheet
  • 13. FUNGSIONAL + REAKTIF = ?? links functions that observe continuous and dynamic streams of data (inputs) to the program behaviour (outputs) in real time
  • 14.  REACTIVECOCOA Adalah kerangka kerja untuk pemrograman reaktif fungsional Menyediakan APA (Antarmuka Pemrograman Aplikasi) untuk mengkomposisi dan mentransformasi aliran dari suatu nilai
  • 20. MAP RACSequence *squared = [numbers.rac_sequence map: ^id(NSNumber *number) { return @([number intValue] * [number intValue]) }];
  • 21. MAP VS FOR RACSequence *squared = [numbers.rac_sequence map: ^id(NSNumber *number) { return @([number intValue] * [number intValue]) }]; NSArray *numbers = @[@4, @5, @6]; NSMutableArray *mutableNums = [numbers mutableCopy]; for (NSNumber *number in numbers) { [mutableNums addObject:@([number intValue] * [number intValue])]; }
  • 23. FILTER RACSequence *evenNums = [numbers.rac_sequence filter: ^BOOL(NSNumber *number) { return @( [number intValue] % 2 == 0); }];
  • 24. FOLD / REDUCE RACSequence *products = [numbers.rac_sequence foldLeftWithStart:@1 reduce:^id( id accumulator, id value) { return @([accumulator intValue] * [value intValue]); }];
  • 26. APPLYING TO AN APP STUDY CASE? FORM VALIDATION
  • 27. THE USUAL WAY - (BOOL) isFormValid { return (self.userNameField.text.length 0 self.emailField.text.length 8 self.passwordField.text.length 8 [self.passwordField.text isEqual:self.passwordVerifyField.text]); } .... .... .... // Kode di atas berada nun jauh di sana #pragma mark - UITextFieldDelegate - (BOOL) textField: (UITextField *) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString*) string { self.submitButton.enabled = [self isFormValid] return YES; }
  • 28. JSON Call? Activity Indicator? Button Disable selama JSON Call dst dsb dkk dll...
  • 29. RAC WAY RAC(self.submitButton, enabled) = [RACSignal combineLatest: @[ self.userNameField.rac_textSignal, self.emailField.rac_textSignal, self.passwordField.rac_textSignal, self.passwordField.rac_textSignal] reduce: ^(NSString *userName, NSString *email, NSString *password, NSString *ver) { return @(userName.length 0 email.length 8 password.length 8 [password isEqual:ver]); }]; Menyatakan SEPERTI APA hubungannya secara deklaratif
  • 31. SELANJUTNYA... MVC? Cek Ray Wenderlich Tutorial tentang MVVM
  • 32.  REACTIVECOCOA Pembuatan aplikasi lebih fokus ke data + UX Mengurangi kompleksitas aplikasi, karena mengurangi peran 'state' Kode yang terelasi, lebih dekat Kode lebih bisa ditest (dengan MVVM, cek raywenderlich)
  • 33.  TAPI... Paradigma Baru dalam memrogram. Modal bikin iOS app sudah mahal, ditambah Cocoa/Cocoa Touch, tambah ReactiveCocoa Buatan  bukan  ReactiveSwift masih dalam tahap pengembangan, Oktober direncanakan rilis
  • 34.
  • 35.  @lynxluna |  lynxluna@gmail.com    