SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
@nikolasburkState Management & Unidirectional Data Flow
State Management &
Unidirectional Data Flow
“Where is truth in your application?”
Andy Matuschak, WWDC 2014
Nikolas Burk
@nikolasburk
• Developer at Graphcool
• Experienced with iOS
• Passionate about programming
paradigms and architecture
1. State Management
2. Unidirectional Data Flow & ReSwift
@nikolasburkState Management & Unidirectional Data Flow
Goals 🎯
State Management
…and why it matters to you
@nikolasburkState Management & Unidirectional Data Flow
@nikolasburkState Management & Unidirectional Data Flow
An Application is more than the
Happy Path
“In the context of software or
information modeling, a happy
path is a default scenario
featuring no exceptional or error
conditions.”
Wikipedia 😏
@nikolasburkState Management & Unidirectional Data Flow
Decision process
for
Slack Notifications
The application state represents the
information that is kept in memory of a
running application and is the basis for the
generation of a user interface.
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
The application state represents the
information that is kept in memory of a
running application and is the basis for the
generation of a user interface.
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
The application state represents the
information that is kept in memory of a
running application and is the basis for
the generation of a user interface.
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
@nikolasburkState Management & Unidirectional Data Flow
The main responsibility of an app is to
transform an application state into a user interface.
(AppState) -> UI
Example: Conference Planner App 🗓
@nikolasburkState Management & Unidirectional Data Flow
struct Conference {
let name: String
let city: String
let year: String
var attending: Bool
}
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
conferences = [
Conference(
name: "AppDevcon",
city: "Amsterdam",
year: "2017",
attending: true
),
Conference(
name: "UIKonf",
city: "Berlin",
year: "2017",
attending: false
),
Conference(
name: "WWDC",
city: "San Jose",
year: "2017",
attending: true
)
]
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
conferences = [
Conference(
name: "AppDevcon",
city: "Amsterdam",
year: "2017",
attending: true
),
Conference(
name: "UIKonf",
city: "Berlin",
year: "2017",
attending: false
),
Conference(
name: "WWDC",
city: "San Jose",
year: "2017",
attending: true
)
]
selectedIndex = 0
Application State? 🤔
@nikolasburkState Management & Unidirectional Data Flow
conferences = [
Conference(
name: "AppDevcon",
city: "Amsterdam",
year: "2017",
attending: true
),
Conference(
name: "UIKonf",
city: "Berlin",
year: "2017",
attending: false
),
Conference(
name: "WWDC",
city: "San Jose",
year: "2017",
attending: true
)
]
selectedIndex = nil
@nikolasburkState Management & Unidirectional Data Flow
1. Where should the state live?
2. Who is allowed to change the state?
3. How does the state get changed?
3 Golden Questions of
State Management 👑
An architectural pattern should be able to answer these questions!
@nikolasburkState Management & Unidirectional Data Flow
Model View Controller
@nikolasburkState Management & Unidirectional Data Flow
Where should state live?
1 👑
@nikolasburkState Management & Unidirectional Data Flow
Who is allowed to change the state?
2 👑
@nikolasburkState Management & Unidirectional Data Flow
How does the state get changed?
KVO & Property Observers
Delegates
Callbacks NSNotificationCenter
Target-Action
3 👑
@nikolasburkState Management & Unidirectional Data Flow
UIViewController
What’s wrong with MVC?
Persistence
Networking
Navigation
Domain Logic
User Interface
Concurrency
@nikolasburkState Management & Unidirectional Data Flow
State Management is
hard
and MVC is not a solution, thanks Apple 😑
Unidirectional Data Flow
… and controlling your application state with ReSwift
@nikolasburkState Management & Unidirectional Data Flow
•
3 Principles
• Single source of truth
• State is read-only
• Changes with pure functions
http://redux.js.org/docs/introduction/ThreePrinciples.html
@nikolasburkState Management & Unidirectional Data Flow
Main Concepts
Store:
… manages the application state
… informs subscribers about changes
Actions:
… describe an intent to change the state
Reducer:
… pure functions that generate a new
application state based on actions
Example Flow
@nikolasburkState Management & Unidirectional Data Flow
Application
State (Old)
AppDevcon
UIKonf
WWDC
Reducer
add Swift Summit
to list and return new
application state
Action
“Swift Summit”
“San Francisco”
“2017”
Application
State (New)
AppDevcon
UIKonf
WWDC
Swift Summit
@nikolasburkState Management & Unidirectional Data Flow
Helpful Resources 📚
• Unidirectional Data Flow in Swift: An Alternative to Massive View
Controllers (Video) (https://realm.io/news/benji-encz-
unidirectional-data-flow-swift/)
• Real World Flux Architecture on iOS (http://blog.benjamin-
encz.de/post/real-world-flux-ios/)
• Redux Documentation (http://redux.js.org/)
• Advanced iOS Application Architecture and Patterns, Andy
Matuschak WWDC 2014 (Video) (http://asciiwwdc.com/2014/
sessions/229)
DEMO
Conference Planner App
Thank you! 🤓
@nikolasburk

Contenu connexe

Tendances

Envi tutorial on satellite photogrammetry lab
Envi tutorial on satellite photogrammetry labEnvi tutorial on satellite photogrammetry lab
Envi tutorial on satellite photogrammetry labSaid Türksever
 
Developing Efficient Web-based GIS Applications
Developing Efficient Web-based GIS ApplicationsDeveloping Efficient Web-based GIS Applications
Developing Efficient Web-based GIS ApplicationsSwetha A
 
What is GIS (PDF).pdf
What is GIS (PDF).pdfWhat is GIS (PDF).pdf
What is GIS (PDF).pdfKartikBhatt43
 
TYBSC IT PGIS Unit III Chapter II Data Entry and Preparation
TYBSC IT PGIS Unit III Chapter II Data Entry and PreparationTYBSC IT PGIS Unit III Chapter II Data Entry and Preparation
TYBSC IT PGIS Unit III Chapter II Data Entry and PreparationArti Parab Academics
 
GIS - Project Planning and Implementation
GIS - Project Planning and ImplementationGIS - Project Planning and Implementation
GIS - Project Planning and ImplementationMalla Reddy University
 
GeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony FoxGeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony FoxDatabricks
 
Data managing and Exchange GDB
Data managing and Exchange GDB Data managing and Exchange GDB
Data managing and Exchange GDB Esri
 
Network analysis in gis , part 4 transportation networks
Network analysis in gis , part 4 transportation networksNetwork analysis in gis , part 4 transportation networks
Network analysis in gis , part 4 transportation networksDepartment of Applied Geology
 
Applications of AI in the geospatial domain
Applications of AI in the geospatial domainApplications of AI in the geospatial domain
Applications of AI in the geospatial domainErik Van Der Zee
 
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...Databricks
 
ESRI Mapping & Charting Solution: ArcGIS 10 Production Mapping
ESRI Mapping & Charting Solution: ArcGIS 10 Production MappingESRI Mapping & Charting Solution: ArcGIS 10 Production Mapping
ESRI Mapping & Charting Solution: ArcGIS 10 Production Mappingmmarques_esri
 
TYBSC IT PGIS Unit II Chapter I Data Management and Processing Systems
TYBSC IT PGIS Unit II Chapter I Data Management and Processing SystemsTYBSC IT PGIS Unit II Chapter I Data Management and Processing Systems
TYBSC IT PGIS Unit II Chapter I Data Management and Processing SystemsArti Parab Academics
 
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...HostedbyConfluent
 

Tendances (20)

Application of GIS in Criminology and Defence Intelligence
Application of GIS in Criminology and Defence IntelligenceApplication of GIS in Criminology and Defence Intelligence
Application of GIS in Criminology and Defence Intelligence
 
How BGP Works
How BGP WorksHow BGP Works
How BGP Works
 
Envi tutorial on satellite photogrammetry lab
Envi tutorial on satellite photogrammetry labEnvi tutorial on satellite photogrammetry lab
Envi tutorial on satellite photogrammetry lab
 
Developing Efficient Web-based GIS Applications
Developing Efficient Web-based GIS ApplicationsDeveloping Efficient Web-based GIS Applications
Developing Efficient Web-based GIS Applications
 
Gps application
Gps applicationGps application
Gps application
 
Web GIS using Google Map and QGIS
Web GIS using Google Map and QGISWeb GIS using Google Map and QGIS
Web GIS using Google Map and QGIS
 
What is GIS (PDF).pdf
What is GIS (PDF).pdfWhat is GIS (PDF).pdf
What is GIS (PDF).pdf
 
TYBSC IT PGIS Unit III Chapter II Data Entry and Preparation
TYBSC IT PGIS Unit III Chapter II Data Entry and PreparationTYBSC IT PGIS Unit III Chapter II Data Entry and Preparation
TYBSC IT PGIS Unit III Chapter II Data Entry and Preparation
 
Moble GIS
Moble GISMoble GIS
Moble GIS
 
GIS - Project Planning and Implementation
GIS - Project Planning and ImplementationGIS - Project Planning and Implementation
GIS - Project Planning and Implementation
 
GeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony FoxGeoMesa on Apache Spark SQL with Anthony Fox
GeoMesa on Apache Spark SQL with Anthony Fox
 
Data managing and Exchange GDB
Data managing and Exchange GDB Data managing and Exchange GDB
Data managing and Exchange GDB
 
Network analysis in gis , part 4 transportation networks
Network analysis in gis , part 4 transportation networksNetwork analysis in gis , part 4 transportation networks
Network analysis in gis , part 4 transportation networks
 
Gis Application
Gis ApplicationGis Application
Gis Application
 
Applications of AI in the geospatial domain
Applications of AI in the geospatial domainApplications of AI in the geospatial domain
Applications of AI in the geospatial domain
 
MongoDB Workshop
MongoDB WorkshopMongoDB Workshop
MongoDB Workshop
 
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
A Deep Dive into Stateful Stream Processing in Structured Streaming with Tath...
 
ESRI Mapping & Charting Solution: ArcGIS 10 Production Mapping
ESRI Mapping & Charting Solution: ArcGIS 10 Production MappingESRI Mapping & Charting Solution: ArcGIS 10 Production Mapping
ESRI Mapping & Charting Solution: ArcGIS 10 Production Mapping
 
TYBSC IT PGIS Unit II Chapter I Data Management and Processing Systems
TYBSC IT PGIS Unit II Chapter I Data Management and Processing SystemsTYBSC IT PGIS Unit II Chapter I Data Management and Processing Systems
TYBSC IT PGIS Unit II Chapter I Data Management and Processing Systems
 
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...
 

Similaire à State Management & Unidirectional Data Flow

No Static: IA for Dynamic Information Environments
No Static: IA for Dynamic Information EnvironmentsNo Static: IA for Dynamic Information Environments
No Static: IA for Dynamic Information EnvironmentsDesign for Context
 
Uxdevsummit - Microservices the modern it stack- trends of tomorrow
Uxdevsummit - Microservices the modern it stack- trends of tomorrowUxdevsummit - Microservices the modern it stack- trends of tomorrow
Uxdevsummit - Microservices the modern it stack- trends of tomorrowJonah Kowall
 
Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017
Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017
Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017eCommerce Institute
 
Technology Trends 2014 and Beyond
Technology Trends 2014 and BeyondTechnology Trends 2014 and Beyond
Technology Trends 2014 and BeyondIMC Institute
 
Making Open Data Useful: Citygram
Making Open Data Useful: CitygramMaking Open Data Useful: Citygram
Making Open Data Useful: CitygramCode for America
 
NUS-ISS Learning Day 2018-Painting Today's digital landscape
NUS-ISS Learning Day 2018-Painting Today's digital landscapeNUS-ISS Learning Day 2018-Painting Today's digital landscape
NUS-ISS Learning Day 2018-Painting Today's digital landscapeNUS-ISS
 
Cloud Trends for Government
Cloud Trends for GovernmentCloud Trends for Government
Cloud Trends for GovernmentDustin Haisler
 
Delivering Self-Service Analytics using Big Data and Data Virtualization on t...
Delivering Self-Service Analytics using Big Data and Data Virtualization on t...Delivering Self-Service Analytics using Big Data and Data Virtualization on t...
Delivering Self-Service Analytics using Big Data and Data Virtualization on t...Denodo
 
The Secure Business in the Digital Age - 27th September 2017
The Secure Business in the Digital Age - 27th September 2017The Secure Business in the Digital Age - 27th September 2017
The Secure Business in the Digital Age - 27th September 2017Exponential_e
 
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4jAI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4jIvan Zoratti
 
Summary of Digital Information from Understanding Context
Summary of Digital Information from Understanding ContextSummary of Digital Information from Understanding Context
Summary of Digital Information from Understanding ContextRoy Kim
 
Nubeliu Presentation in Peru v2
Nubeliu Presentation in Peru v2Nubeliu Presentation in Peru v2
Nubeliu Presentation in Peru v2Alex Hübner
 
Better Software is Better than Worse Software - Michael Coté
Better Software is Better than Worse Software - Michael CotéBetter Software is Better than Worse Software - Michael Coté
Better Software is Better than Worse Software - Michael CotéVMware Tanzu
 
GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...
GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...
GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...Neo4j
 
TCO: An Achilles Heel of Hand-Built Data Warehouses
TCO: An Achilles Heel of Hand-Built Data WarehousesTCO: An Achilles Heel of Hand-Built Data Warehouses
TCO: An Achilles Heel of Hand-Built Data WarehousesKalido
 
Mobility and the Real-Time Enterprise
Mobility and the Real-Time EnterpriseMobility and the Real-Time Enterprise
Mobility and the Real-Time EnterpriseAnyPresence
 
SPSNYC2019 - What is Common Data Model and how to use it?
SPSNYC2019 - What is Common Data Model and how to use it?SPSNYC2019 - What is Common Data Model and how to use it?
SPSNYC2019 - What is Common Data Model and how to use it?Nicolas Georgeault
 
Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...
Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...
Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...LinkedIn Talent Solutions
 
Mobile, Philip Nyborg
Mobile, Philip NyborgMobile, Philip Nyborg
Mobile, Philip NyborgIBM Danmark
 
Planning for a Digital Future
Planning for a Digital FuturePlanning for a Digital Future
Planning for a Digital FutureNETSCOUT
 

Similaire à State Management & Unidirectional Data Flow (20)

No Static: IA for Dynamic Information Environments
No Static: IA for Dynamic Information EnvironmentsNo Static: IA for Dynamic Information Environments
No Static: IA for Dynamic Information Environments
 
Uxdevsummit - Microservices the modern it stack- trends of tomorrow
Uxdevsummit - Microservices the modern it stack- trends of tomorrowUxdevsummit - Microservices the modern it stack- trends of tomorrow
Uxdevsummit - Microservices the modern it stack- trends of tomorrow
 
Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017
Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017
Presentación Marcos Grilanda /Amazon Web Services - eCommerce Day Santiago 2017
 
Technology Trends 2014 and Beyond
Technology Trends 2014 and BeyondTechnology Trends 2014 and Beyond
Technology Trends 2014 and Beyond
 
Making Open Data Useful: Citygram
Making Open Data Useful: CitygramMaking Open Data Useful: Citygram
Making Open Data Useful: Citygram
 
NUS-ISS Learning Day 2018-Painting Today's digital landscape
NUS-ISS Learning Day 2018-Painting Today's digital landscapeNUS-ISS Learning Day 2018-Painting Today's digital landscape
NUS-ISS Learning Day 2018-Painting Today's digital landscape
 
Cloud Trends for Government
Cloud Trends for GovernmentCloud Trends for Government
Cloud Trends for Government
 
Delivering Self-Service Analytics using Big Data and Data Virtualization on t...
Delivering Self-Service Analytics using Big Data and Data Virtualization on t...Delivering Self-Service Analytics using Big Data and Data Virtualization on t...
Delivering Self-Service Analytics using Big Data and Data Virtualization on t...
 
The Secure Business in the Digital Age - 27th September 2017
The Secure Business in the Digital Age - 27th September 2017The Secure Business in the Digital Age - 27th September 2017
The Secure Business in the Digital Age - 27th September 2017
 
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4jAI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
AI, ML and Graph Algorithms: Real Life Use Cases with Neo4j
 
Summary of Digital Information from Understanding Context
Summary of Digital Information from Understanding ContextSummary of Digital Information from Understanding Context
Summary of Digital Information from Understanding Context
 
Nubeliu Presentation in Peru v2
Nubeliu Presentation in Peru v2Nubeliu Presentation in Peru v2
Nubeliu Presentation in Peru v2
 
Better Software is Better than Worse Software - Michael Coté
Better Software is Better than Worse Software - Michael CotéBetter Software is Better than Worse Software - Michael Coté
Better Software is Better than Worse Software - Michael Coté
 
GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...
GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...
GraphConnect Europe 2016 - IoT - where do Graphs fit with Business Requiremen...
 
TCO: An Achilles Heel of Hand-Built Data Warehouses
TCO: An Achilles Heel of Hand-Built Data WarehousesTCO: An Achilles Heel of Hand-Built Data Warehouses
TCO: An Achilles Heel of Hand-Built Data Warehouses
 
Mobility and the Real-Time Enterprise
Mobility and the Real-Time EnterpriseMobility and the Real-Time Enterprise
Mobility and the Real-Time Enterprise
 
SPSNYC2019 - What is Common Data Model and how to use it?
SPSNYC2019 - What is Common Data Model and how to use it?SPSNYC2019 - What is Common Data Model and how to use it?
SPSNYC2019 - What is Common Data Model and how to use it?
 
Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...
Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...
Keen on the Small Screen: The Power of Mobile for Candidate Experience | Tale...
 
Mobile, Philip Nyborg
Mobile, Philip NyborgMobile, Philip Nyborg
Mobile, Philip Nyborg
 
Planning for a Digital Future
Planning for a Digital FuturePlanning for a Digital Future
Planning for a Digital Future
 

Plus de Nikolas Burk

Next-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNext-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNikolas Burk
 
Code-first GraphQL Server Development with Prisma
Code-first  GraphQL Server Development with PrismaCode-first  GraphQL Server Development with Prisma
Code-first GraphQL Server Development with PrismaNikolas Burk
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchNikolas Burk
 
GraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & ContentfulGraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & ContentfulNikolas Burk
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma CloudNikolas Burk
 
Building GraphQL Servers with Node.JS & Prisma
Building GraphQL Servers with Node.JS & PrismaBuilding GraphQL Servers with Node.JS & Prisma
Building GraphQL Servers with Node.JS & PrismaNikolas Burk
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018Nikolas Burk
 
Building Serverless GraphQL Backends
Building Serverless GraphQL BackendsBuilding Serverless GraphQL Backends
Building Serverless GraphQL BackendsNikolas Burk
 
GraphQL Subscriptions
GraphQL SubscriptionsGraphQL Subscriptions
GraphQL SubscriptionsNikolas Burk
 
The Serverless GraphQL Backend Architecture
The Serverless GraphQL Backend ArchitectureThe Serverless GraphQL Backend Architecture
The Serverless GraphQL Backend ArchitectureNikolas Burk
 
Diving into GraphQL, React & Apollo
Diving into GraphQL, React & ApolloDiving into GraphQL, React & Apollo
Diving into GraphQL, React & ApolloNikolas Burk
 
Authentication, Authorization & Error Handling with GraphQL
Authentication, Authorization & Error Handling with GraphQLAuthentication, Authorization & Error Handling with GraphQL
Authentication, Authorization & Error Handling with GraphQLNikolas Burk
 
Getting Started with Relay Modern
Getting Started with Relay ModernGetting Started with Relay Modern
Getting Started with Relay ModernNikolas Burk
 
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions Nikolas Burk
 
Building a Realtime Chat with React & GraphQL Subscriptions
Building a Realtime Chat with React & GraphQL Subscriptions Building a Realtime Chat with React & GraphQL Subscriptions
Building a Realtime Chat with React & GraphQL Subscriptions Nikolas Burk
 
REST in Peace - Using GraphQL with Apollo on iOS
REST in Peace - Using GraphQL with Apollo on iOSREST in Peace - Using GraphQL with Apollo on iOS
REST in Peace - Using GraphQL with Apollo on iOSNikolas Burk
 

Plus de Nikolas Burk (17)

Next-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNext-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and Prisma
 
Code-first GraphQL Server Development with Prisma
Code-first  GraphQL Server Development with PrismaCode-first  GraphQL Server Development with Prisma
Code-first GraphQL Server Development with Prisma
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
 
GraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & ContentfulGraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & Contentful
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
 
Building GraphQL Servers with Node.JS & Prisma
Building GraphQL Servers with Node.JS & PrismaBuilding GraphQL Servers with Node.JS & Prisma
Building GraphQL Servers with Node.JS & Prisma
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018
 
React & GraphQL
React & GraphQLReact & GraphQL
React & GraphQL
 
Building Serverless GraphQL Backends
Building Serverless GraphQL BackendsBuilding Serverless GraphQL Backends
Building Serverless GraphQL Backends
 
GraphQL Subscriptions
GraphQL SubscriptionsGraphQL Subscriptions
GraphQL Subscriptions
 
The Serverless GraphQL Backend Architecture
The Serverless GraphQL Backend ArchitectureThe Serverless GraphQL Backend Architecture
The Serverless GraphQL Backend Architecture
 
Diving into GraphQL, React & Apollo
Diving into GraphQL, React & ApolloDiving into GraphQL, React & Apollo
Diving into GraphQL, React & Apollo
 
Authentication, Authorization & Error Handling with GraphQL
Authentication, Authorization & Error Handling with GraphQLAuthentication, Authorization & Error Handling with GraphQL
Authentication, Authorization & Error Handling with GraphQL
 
Getting Started with Relay Modern
Getting Started with Relay ModernGetting Started with Relay Modern
Getting Started with Relay Modern
 
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions
Building a Realtime Chat with React Native (Expo) & GraphQL Subscriptions
 
Building a Realtime Chat with React & GraphQL Subscriptions
Building a Realtime Chat with React & GraphQL Subscriptions Building a Realtime Chat with React & GraphQL Subscriptions
Building a Realtime Chat with React & GraphQL Subscriptions
 
REST in Peace - Using GraphQL with Apollo on iOS
REST in Peace - Using GraphQL with Apollo on iOSREST in Peace - Using GraphQL with Apollo on iOS
REST in Peace - Using GraphQL with Apollo on iOS
 

Dernier

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 

Dernier (20)

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

State Management & Unidirectional Data Flow

  • 1. @nikolasburkState Management & Unidirectional Data Flow State Management & Unidirectional Data Flow “Where is truth in your application?” Andy Matuschak, WWDC 2014
  • 2. Nikolas Burk @nikolasburk • Developer at Graphcool • Experienced with iOS • Passionate about programming paradigms and architecture
  • 3. 1. State Management 2. Unidirectional Data Flow & ReSwift @nikolasburkState Management & Unidirectional Data Flow Goals 🎯
  • 4. State Management …and why it matters to you
  • 5. @nikolasburkState Management & Unidirectional Data Flow
  • 6. @nikolasburkState Management & Unidirectional Data Flow An Application is more than the Happy Path “In the context of software or information modeling, a happy path is a default scenario featuring no exceptional or error conditions.” Wikipedia 😏
  • 7. @nikolasburkState Management & Unidirectional Data Flow Decision process for Slack Notifications
  • 8. The application state represents the information that is kept in memory of a running application and is the basis for the generation of a user interface. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow
  • 9. The application state represents the information that is kept in memory of a running application and is the basis for the generation of a user interface. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow
  • 10. The application state represents the information that is kept in memory of a running application and is the basis for the generation of a user interface. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow
  • 11. @nikolasburkState Management & Unidirectional Data Flow The main responsibility of an app is to transform an application state into a user interface. (AppState) -> UI
  • 12. Example: Conference Planner App 🗓 @nikolasburkState Management & Unidirectional Data Flow struct Conference { let name: String let city: String let year: String var attending: Bool }
  • 13. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow conferences = [ Conference( name: "AppDevcon", city: "Amsterdam", year: "2017", attending: true ), Conference( name: "UIKonf", city: "Berlin", year: "2017", attending: false ), Conference( name: "WWDC", city: "San Jose", year: "2017", attending: true ) ]
  • 14. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow conferences = [ Conference( name: "AppDevcon", city: "Amsterdam", year: "2017", attending: true ), Conference( name: "UIKonf", city: "Berlin", year: "2017", attending: false ), Conference( name: "WWDC", city: "San Jose", year: "2017", attending: true ) ] selectedIndex = 0
  • 15. Application State? 🤔 @nikolasburkState Management & Unidirectional Data Flow conferences = [ Conference( name: "AppDevcon", city: "Amsterdam", year: "2017", attending: true ), Conference( name: "UIKonf", city: "Berlin", year: "2017", attending: false ), Conference( name: "WWDC", city: "San Jose", year: "2017", attending: true ) ] selectedIndex = nil
  • 16. @nikolasburkState Management & Unidirectional Data Flow 1. Where should the state live? 2. Who is allowed to change the state? 3. How does the state get changed? 3 Golden Questions of State Management 👑 An architectural pattern should be able to answer these questions!
  • 17. @nikolasburkState Management & Unidirectional Data Flow Model View Controller
  • 18. @nikolasburkState Management & Unidirectional Data Flow Where should state live? 1 👑
  • 19. @nikolasburkState Management & Unidirectional Data Flow Who is allowed to change the state? 2 👑
  • 20. @nikolasburkState Management & Unidirectional Data Flow How does the state get changed? KVO & Property Observers Delegates Callbacks NSNotificationCenter Target-Action 3 👑
  • 21. @nikolasburkState Management & Unidirectional Data Flow UIViewController What’s wrong with MVC? Persistence Networking Navigation Domain Logic User Interface Concurrency
  • 22. @nikolasburkState Management & Unidirectional Data Flow State Management is hard and MVC is not a solution, thanks Apple 😑
  • 23. Unidirectional Data Flow … and controlling your application state with ReSwift
  • 24. @nikolasburkState Management & Unidirectional Data Flow • 3 Principles • Single source of truth • State is read-only • Changes with pure functions http://redux.js.org/docs/introduction/ThreePrinciples.html
  • 25. @nikolasburkState Management & Unidirectional Data Flow Main Concepts Store: … manages the application state … informs subscribers about changes Actions: … describe an intent to change the state Reducer: … pure functions that generate a new application state based on actions
  • 26. Example Flow @nikolasburkState Management & Unidirectional Data Flow
  • 27. Application State (Old) AppDevcon UIKonf WWDC Reducer add Swift Summit to list and return new application state Action “Swift Summit” “San Francisco” “2017” Application State (New) AppDevcon UIKonf WWDC Swift Summit
  • 28. @nikolasburkState Management & Unidirectional Data Flow Helpful Resources 📚 • Unidirectional Data Flow in Swift: An Alternative to Massive View Controllers (Video) (https://realm.io/news/benji-encz- unidirectional-data-flow-swift/) • Real World Flux Architecture on iOS (http://blog.benjamin- encz.de/post/real-world-flux-ios/) • Redux Documentation (http://redux.js.org/) • Advanced iOS Application Architecture and Patterns, Andy Matuschak WWDC 2014 (Video) (http://asciiwwdc.com/2014/ sessions/229)
  • 30.