SlideShare a Scribd company logo
1 of 20
Download to read offline
modularity à la taliban
with compositional events
Jon Sterling

jonmsterling.com
@jonsterling
modularity à la taliban
with compositional events
Jon Sterling

jonmsterling.com
@jonsterling
reality-based design
with compositional events
Jon Sterling

jonmsterling.com
@jonsterling
mvvm is not enough
example
view controller:!
RAC(viewModel, message) = textField.rac_textSignal;

submitButton.action = viewModel.submitAction;
view model:!
_submitAction = [RACDynamicSignalGenerator
generatorWithBlock:^(id input) {

@strongify(self);

return sendRequest(self.message);

}].action;
differentiate state from
input
the old way
@interface MessagesViewModel : NSObject

@property (copy) NSString *message;



/// submitAction : RACAction () _

@property (readonly) RACAction *submitAction;

@end
the new way
@interface MessagesViewModel : NSObject

/// submitAction : RACAction NSString _

@property (readonly) RACAction *submitAction;

@end
example
view controller:!
submitButton.action = [[textField.rac_textSignal take:1].action
postCompose:viewModel.submitAction].action;
view model:!
_submitAction = [RACDynamicSignalGenerator
generatorWithBlock:^(NSString *message) {

return sendRequest(message);

}].action;
where did the state go?
@interface MessagesViewModel : NSObject



/// submitAction : RACAction NSString _

@property (readonly) RACAction *submitAction;



/// statesSignal : RACSignal MessagesState

@property (readonly) RACSignal *statesSignal;



@end
the state
@interface MessagesState : NSObject

/// messages : NSArray NSString

@property (readonly) NSArray *messages;



+ (instancetype)emptyState;

- (instancetype)stateByAddingMessage:(NSString
*)msg;

@end
example
view model:!
_submitAction = [RACDynamicSignalGenerator
generatorWithBlock:^(NSString *message) {

return [sendRequest(self.message) then:^{

return [RACSignal return:^(MessagesState
*state) {

return [state
stateByAddingMessage:message];

}];

}];

}].action;
example
view model:!
_submitAction = …;



RACSubject *statesSubject = [RACSubject subject];

[submitAction.results 

scanWithStart:[MessagesState emptyState] 

reduce:^(MessageState *state, MessageState
*(^transform)(MessageState *)) {

return transform(state);

}] subscribe:statesSubject];



_statesSignal = statesSubject;
example
view controller:!
RAC(self, messagesView.items) =
[self.viewModel.statesSignal map:^(MessagesState
*state) {

return state.messages;

}];
separate signature
from structure
• The view controller does not need to know how to
create a view model
• The view controller does not need to know how to
create a model state
signature vs. structure
public signature (exposed to view controller):!
@protocol MessagesState <NSObject>

/// messages : NSArray NSString

@property (readonly) NSArray *messages;

@end
structure private to view model:!
@interface MessagesState : NSObject <MessagesState> 

+ (instancetype)emptyState;

- (instancetype)stateByAddingMessage:(NSString *)msg;

@end
signature vs. structure
public signature (exposed to view controller):!
@protocol MessagesViewModel <NSObject>

@property (readonly) RACAction *submitAction;

@property (readonly) RACSignal *statesSignal;

@end
structure private to creator of view model:!
@interface MessagesViewModel : NSObject <
MessagesViewModel> 

- (id)initWithRecipient:(Recipient *)recipient;

@end
signature vs. structure
view controller!
@interface MessagesViewController : NSObject

- (id)initWithViewModel:
(id<MessagesViewModel>)viewModel

@end
DEMO

More Related Content

What's hot

Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native IntroductionVisual Engineering
 
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSDependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSRemo Jansen
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥Remo Jansen
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareVisual Engineering
 
AngularJS (1.x) as fast as a lightning
AngularJS (1.x)as fast as a lightningAngularJS (1.x)as fast as a lightning
AngularJS (1.x) as fast as a lightningBartłomiej Narożnik
 
Railsconf 2017 - React & React Native a common codebase across native and web
Railsconf 2017 - React & React Native a common codebase across native and webRailsconf 2017 - React & React Native a common codebase across native and web
Railsconf 2017 - React & React Native a common codebase across native and webtalkingquickly
 
Asynchronous javascript
 Asynchronous javascript Asynchronous javascript
Asynchronous javascriptEman Mohamed
 
Services Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJSServices Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJSSumanth krishna
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)Jo Cranford
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Eric Torreborre
 
7 Redux challenges
7 Redux challenges7 Redux challenges
7 Redux challengesreactima
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)Binary Studio
 

What's hot (20)

Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native Introduction
 
React and redux
React and reduxReact and redux
React and redux
 
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSDependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJS
 
Ruby loves DDD
Ruby loves DDDRuby loves DDD
Ruby loves DDD
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux Middleware
 
Understanding AJAX
Understanding AJAXUnderstanding AJAX
Understanding AJAX
 
React.js
React.jsReact.js
React.js
 
AngularJS (1.x) as fast as a lightning
AngularJS (1.x)as fast as a lightningAngularJS (1.x)as fast as a lightning
AngularJS (1.x) as fast as a lightning
 
Railsconf 2017 - React & React Native a common codebase across native and web
Railsconf 2017 - React & React Native a common codebase across native and webRailsconf 2017 - React & React Native a common codebase across native and web
Railsconf 2017 - React & React Native a common codebase across native and web
 
Angular js
Angular jsAngular js
Angular js
 
Asynchronous javascript
 Asynchronous javascript Asynchronous javascript
Asynchronous javascript
 
Redux workshop
Redux workshopRedux workshop
Redux workshop
 
Rails concepts
Rails conceptsRails concepts
Rails concepts
 
Services Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJSServices Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJS
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)
 
7 Redux challenges
7 Redux challenges7 Redux challenges
7 Redux challenges
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
 

Viewers also liked

10eko aurkezpenak
10eko aurkezpenak10eko aurkezpenak
10eko aurkezpenakjavitoooooo
 
портфоліо
портфоліо  портфоліо
портфоліо livnom
 
Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)jonsterling
 
Survey Insights Into Brands & User-Generated Video Content
Survey Insights Into Brands & User-Generated Video ContentSurvey Insights Into Brands & User-Generated Video Content
Survey Insights Into Brands & User-Generated Video ContentBrickfish
 
Tips to Optimize Your Twitter Strategy
Tips to Optimize Your Twitter StrategyTips to Optimize Your Twitter Strategy
Tips to Optimize Your Twitter StrategyBrickfish
 
Galois Tech Talk / Vinyl: Records in Haskell and Type Theory
Galois Tech Talk / Vinyl: Records in Haskell and Type TheoryGalois Tech Talk / Vinyl: Records in Haskell and Type Theory
Galois Tech Talk / Vinyl: Records in Haskell and Type Theoryjonsterling
 
Women herbalife opportunity meeting call-9717858028
Women herbalife opportunity meeting call-9717858028Women herbalife opportunity meeting call-9717858028
Women herbalife opportunity meeting call-9717858028Ashikhan12
 
20 Statistics for Your Back to School Digital Marketing Strategy
20 Statistics for Your Back to School Digital Marketing Strategy20 Statistics for Your Back to School Digital Marketing Strategy
20 Statistics for Your Back to School Digital Marketing StrategyBrickfish
 
Leading By Example and Building Harmonious Relationship
Leading By Example and Building Harmonious RelationshipLeading By Example and Building Harmonious Relationship
Leading By Example and Building Harmonious RelationshipElvie Barsaga
 
Professional Standards: Social Media and Professionalism
Professional Standards: Social Media and ProfessionalismProfessional Standards: Social Media and Professionalism
Professional Standards: Social Media and ProfessionalismWill Patch
 

Viewers also liked (13)

Matching problem
Matching problemMatching problem
Matching problem
 
10eko aurkezpenak
10eko aurkezpenak10eko aurkezpenak
10eko aurkezpenak
 
портфоліо
портфоліо  портфоліо
портфоліо
 
Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)
 
Serramenti Vicenza
Serramenti VicenzaSerramenti Vicenza
Serramenti Vicenza
 
Survey Insights Into Brands & User-Generated Video Content
Survey Insights Into Brands & User-Generated Video ContentSurvey Insights Into Brands & User-Generated Video Content
Survey Insights Into Brands & User-Generated Video Content
 
Tips to Optimize Your Twitter Strategy
Tips to Optimize Your Twitter StrategyTips to Optimize Your Twitter Strategy
Tips to Optimize Your Twitter Strategy
 
Galois Tech Talk / Vinyl: Records in Haskell and Type Theory
Galois Tech Talk / Vinyl: Records in Haskell and Type TheoryGalois Tech Talk / Vinyl: Records in Haskell and Type Theory
Galois Tech Talk / Vinyl: Records in Haskell and Type Theory
 
Women herbalife opportunity meeting call-9717858028
Women herbalife opportunity meeting call-9717858028Women herbalife opportunity meeting call-9717858028
Women herbalife opportunity meeting call-9717858028
 
La refrigeracion
La refrigeracionLa refrigeracion
La refrigeracion
 
20 Statistics for Your Back to School Digital Marketing Strategy
20 Statistics for Your Back to School Digital Marketing Strategy20 Statistics for Your Back to School Digital Marketing Strategy
20 Statistics for Your Back to School Digital Marketing Strategy
 
Leading By Example and Building Harmonious Relationship
Leading By Example and Building Harmonious RelationshipLeading By Example and Building Harmonious Relationship
Leading By Example and Building Harmonious Relationship
 
Professional Standards: Social Media and Professionalism
Professional Standards: Social Media and ProfessionalismProfessional Standards: Social Media and Professionalism
Professional Standards: Social Media and Professionalism
 

Similar to modularity à la taliban

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
 
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3Rob Tweed
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databindingBoulos Dib
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs[T]echdencias
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the clientSebastiano Armeli
 
Hybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaHybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaAyman Mahfouz
 
Academy PRO: React JS
Academy PRO: React JSAcademy PRO: React JS
Academy PRO: React JSBinary Studio
 
The art of Building Bridges for Android Hybrid Apps
The art of Building Bridges for Android Hybrid AppsThe art of Building Bridges for Android Hybrid Apps
The art of Building Bridges for Android Hybrid AppsBartłomiej Pisulak
 
Architectures in the compose world
Architectures in the compose worldArchitectures in the compose world
Architectures in the compose worldFabio Collini
 
MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...
MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...
MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...jaxconf
 
Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Robert DeLuca
 
Wss Object Model
Wss Object ModelWss Object Model
Wss Object Modelmaddinapudi
 
Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11Kamil Augustynowicz
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with ReduxVedran Blaženka
 

Similar to modularity à la taliban (20)

Intro to Sail.js
Intro to Sail.jsIntro to Sail.js
Intro to Sail.js
 
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
 
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databinding
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the client
 
Hybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaHybrid apps - Your own mini Cordova
Hybrid apps - Your own mini Cordova
 
Academy PRO: React JS
Academy PRO: React JSAcademy PRO: React JS
Academy PRO: React JS
 
The art of Building Bridges for Android Hybrid Apps
The art of Building Bridges for Android Hybrid AppsThe art of Building Bridges for Android Hybrid Apps
The art of Building Bridges for Android Hybrid Apps
 
MVC 2.0 - A Breakthrough
MVC 2.0 - A BreakthroughMVC 2.0 - A Breakthrough
MVC 2.0 - A Breakthrough
 
Architectures in the compose world
Architectures in the compose worldArchitectures in the compose world
Architectures in the compose world
 
MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...
MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...
MVC on the Server and on the Client: How to Integrate Spring MVC and Backbone...
 
Asp.NET MVC
Asp.NET MVCAsp.NET MVC
Asp.NET MVC
 
Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React
 
JSON
JSONJSON
JSON
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Wss Object Model
Wss Object ModelWss Object Model
Wss Object Model
 
How to React Native
How to React NativeHow to React Native
How to React Native
 
Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

modularity à la taliban

  • 1. modularity à la taliban with compositional events Jon Sterling
 jonmsterling.com @jonsterling
  • 2. modularity à la taliban with compositional events Jon Sterling
 jonmsterling.com @jonsterling
  • 3. reality-based design with compositional events Jon Sterling
 jonmsterling.com @jonsterling
  • 4. mvvm is not enough
  • 5. example view controller:! RAC(viewModel, message) = textField.rac_textSignal;
 submitButton.action = viewModel.submitAction; view model:! _submitAction = [RACDynamicSignalGenerator generatorWithBlock:^(id input) {
 @strongify(self);
 return sendRequest(self.message);
 }].action;
  • 7. the old way @interface MessagesViewModel : NSObject
 @property (copy) NSString *message;
 
 /// submitAction : RACAction () _
 @property (readonly) RACAction *submitAction;
 @end
  • 8. the new way @interface MessagesViewModel : NSObject
 /// submitAction : RACAction NSString _
 @property (readonly) RACAction *submitAction;
 @end
  • 9. example view controller:! submitButton.action = [[textField.rac_textSignal take:1].action postCompose:viewModel.submitAction].action; view model:! _submitAction = [RACDynamicSignalGenerator generatorWithBlock:^(NSString *message) {
 return sendRequest(message);
 }].action;
  • 10. where did the state go? @interface MessagesViewModel : NSObject
 
 /// submitAction : RACAction NSString _
 @property (readonly) RACAction *submitAction;
 
 /// statesSignal : RACSignal MessagesState
 @property (readonly) RACSignal *statesSignal;
 
 @end
  • 11. the state @interface MessagesState : NSObject
 /// messages : NSArray NSString
 @property (readonly) NSArray *messages;
 
 + (instancetype)emptyState;
 - (instancetype)stateByAddingMessage:(NSString *)msg;
 @end
  • 12. example view model:! _submitAction = [RACDynamicSignalGenerator generatorWithBlock:^(NSString *message) {
 return [sendRequest(self.message) then:^{
 return [RACSignal return:^(MessagesState *state) {
 return [state stateByAddingMessage:message];
 }];
 }];
 }].action;
  • 13. example view model:! _submitAction = …;
 
 RACSubject *statesSubject = [RACSubject subject];
 [submitAction.results 
 scanWithStart:[MessagesState emptyState] 
 reduce:^(MessageState *state, MessageState *(^transform)(MessageState *)) {
 return transform(state);
 }] subscribe:statesSubject];
 
 _statesSignal = statesSubject;
  • 14. example view controller:! RAC(self, messagesView.items) = [self.viewModel.statesSignal map:^(MessagesState *state) {
 return state.messages;
 }];
  • 16. • The view controller does not need to know how to create a view model • The view controller does not need to know how to create a model state
  • 17. signature vs. structure public signature (exposed to view controller):! @protocol MessagesState <NSObject>
 /// messages : NSArray NSString
 @property (readonly) NSArray *messages;
 @end structure private to view model:! @interface MessagesState : NSObject <MessagesState> 
 + (instancetype)emptyState;
 - (instancetype)stateByAddingMessage:(NSString *)msg;
 @end
  • 18. signature vs. structure public signature (exposed to view controller):! @protocol MessagesViewModel <NSObject>
 @property (readonly) RACAction *submitAction;
 @property (readonly) RACSignal *statesSignal;
 @end structure private to creator of view model:! @interface MessagesViewModel : NSObject < MessagesViewModel> 
 - (id)initWithRecipient:(Recipient *)recipient;
 @end
  • 19. signature vs. structure view controller! @interface MessagesViewController : NSObject
 - (id)initWithViewModel: (id<MessagesViewModel>)viewModel
 @end
  • 20. DEMO