SlideShare a Scribd company logo
@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

More Related Content

What's hot

Solution+Architecture+Review+Template.pptx
Solution+Architecture+Review+Template.pptxSolution+Architecture+Review+Template.pptx
Solution+Architecture+Review+Template.pptx
Dr. Srinivas Telukunta
 
Use of administrative privilege levels in netapp cluster 8.x
Use of administrative privilege levels in netapp cluster 8.xUse of administrative privilege levels in netapp cluster 8.x
Use of administrative privilege levels in netapp cluster 8.x
Saroj Sahu
 
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
Jiyeon Seo
 
Airflow Clustering and High Availability
Airflow Clustering and High AvailabilityAirflow Clustering and High Availability
Airflow Clustering and High Availability
Robert Sanders
 
Evolution of CSS
Evolution of CSSEvolution of CSS
Evolution of CSS
Ecaterina Moraru (Valica)
 
آشنایی با مفاهیم عمومی و اصلی TOGAF
آشنایی با مفاهیم عمومی و اصلی TOGAF آشنایی با مفاهیم عمومی و اصلی TOGAF
آشنایی با مفاهیم عمومی و اصلی TOGAF
Amir Darajeh
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
Sergey Seletsky
 
Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)
Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)
Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)
James Robertson
 
Practical Enterprise Architecture in Medium-size Corporation using TOGAF
Practical Enterprise Architecture in Medium-size Corporation using TOGAFPractical Enterprise Architecture in Medium-size Corporation using TOGAF
Practical Enterprise Architecture in Medium-size Corporation using TOGAF
Michael Sukachev
 
Library management system
Library management systemLibrary management system
Library management system
SHARDA SHARAN
 
카카오스토리 웹팀의 코드리뷰 경험
카카오스토리 웹팀의 코드리뷰 경험카카오스토리 웹팀의 코드리뷰 경험
카카오스토리 웹팀의 코드리뷰 경험
Ohgyun Ahn
 
PHPデプロイツールの世界
PHPデプロイツールの世界PHPデプロイツールの世界
PHPデプロイツールの世界
Yuuki Takezawa
 
Multi Account Route 53
Multi Account Route 53 Multi Account Route 53
Multi Account Route 53
Practical Code, LLC
 
Introduction to Nginx
Introduction to NginxIntroduction to Nginx
Introduction to Nginx
Knoldus Inc.
 
Application Portfolio Management
Application Portfolio ManagementApplication Portfolio Management
Application Portfolio Management
Alain Charpentier
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
Vasavi College of Engg
 
Java script ba kurdi
Java script ba kurdiJava script ba kurdi
Java script ba kurdi
Azad Mzuri
 
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
Mumbai B.Sc.IT Study
 
Agile, TOGAF and Enterprise Architecture: Will They Blend?
Agile, TOGAF and Enterprise Architecture:  Will They Blend?Agile, TOGAF and Enterprise Architecture:  Will They Blend?
Agile, TOGAF and Enterprise Architecture: Will They Blend?
Danny Greefhorst
 
클라우드 엔지니어 취업 고군 분투기
클라우드 엔지니어 취업 고군 분투기클라우드 엔지니어 취업 고군 분투기
클라우드 엔지니어 취업 고군 분투기
InfraEngineer
 

What's hot (20)

Solution+Architecture+Review+Template.pptx
Solution+Architecture+Review+Template.pptxSolution+Architecture+Review+Template.pptx
Solution+Architecture+Review+Template.pptx
 
Use of administrative privilege levels in netapp cluster 8.x
Use of administrative privilege levels in netapp cluster 8.xUse of administrative privilege levels in netapp cluster 8.x
Use of administrative privilege levels in netapp cluster 8.x
 
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
코드 리뷰의 또 다른 접근 방법: Pull Requests vs. Stacked Changes
 
Airflow Clustering and High Availability
Airflow Clustering and High AvailabilityAirflow Clustering and High Availability
Airflow Clustering and High Availability
 
Evolution of CSS
Evolution of CSSEvolution of CSS
Evolution of CSS
 
آشنایی با مفاهیم عمومی و اصلی TOGAF
آشنایی با مفاهیم عمومی و اصلی TOGAF آشنایی با مفاهیم عمومی و اصلی TOGAF
آشنایی با مفاهیم عمومی و اصلی TOGAF
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)
Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)
Digital employee experience: heart of the digital workplace (Denmark, Feb 2018)
 
Practical Enterprise Architecture in Medium-size Corporation using TOGAF
Practical Enterprise Architecture in Medium-size Corporation using TOGAFPractical Enterprise Architecture in Medium-size Corporation using TOGAF
Practical Enterprise Architecture in Medium-size Corporation using TOGAF
 
Library management system
Library management systemLibrary management system
Library management system
 
카카오스토리 웹팀의 코드리뷰 경험
카카오스토리 웹팀의 코드리뷰 경험카카오스토리 웹팀의 코드리뷰 경험
카카오스토리 웹팀의 코드리뷰 경험
 
PHPデプロイツールの世界
PHPデプロイツールの世界PHPデプロイツールの世界
PHPデプロイツールの世界
 
Multi Account Route 53
Multi Account Route 53 Multi Account Route 53
Multi Account Route 53
 
Introduction to Nginx
Introduction to NginxIntroduction to Nginx
Introduction to Nginx
 
Application Portfolio Management
Application Portfolio ManagementApplication Portfolio Management
Application Portfolio Management
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
Java script ba kurdi
Java script ba kurdiJava script ba kurdi
Java script ba kurdi
 
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
Artificial Intelligence (November – 2018) [Choice Based | Question Paper]
 
Agile, TOGAF and Enterprise Architecture: Will They Blend?
Agile, TOGAF and Enterprise Architecture:  Will They Blend?Agile, TOGAF and Enterprise Architecture:  Will They Blend?
Agile, TOGAF and Enterprise Architecture: Will They Blend?
 
클라우드 엔지니어 취업 고군 분투기
클라우드 엔지니어 취업 고군 분투기클라우드 엔지니어 취업 고군 분투기
클라우드 엔지니어 취업 고군 분투기
 

Similar to 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 Environments
Design 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 tomorrow
Jonah 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 2017
eCommerce Institute
 
Technology Trends 2014 and Beyond
Technology Trends 2014 and BeyondTechnology Trends 2014 and Beyond
Technology Trends 2014 and Beyond
IMC Institute
 
Making Open Data Useful: Citygram
Making Open Data Useful: CitygramMaking Open Data Useful: Citygram
Making Open Data Useful: Citygram
Code 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 landscape
NUS-ISS
 
Cloud Trends for Government
Cloud Trends for GovernmentCloud Trends for Government
Cloud Trends for Government
Dustin 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 2017
Exponential_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 Neo4j
Ivan 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 Context
Roy Kim
 
Nubeliu Presentation in Peru v2
Nubeliu Presentation in Peru v2Nubeliu Presentation in Peru v2
Nubeliu Presentation in Peru v2
Alex 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 Warehouses
Kalido
 
Mobility and the Real-Time Enterprise
Mobility and the Real-Time EnterpriseMobility and the Real-Time Enterprise
Mobility and the Real-Time Enterprise
AnyPresence
 
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 Nyborg
IBM Danmark
 
Planning for a Digital Future
Planning for a Digital FuturePlanning for a Digital Future
Planning for a Digital Future
NETSCOUT
 

Similar to 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
 

More from 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 Prisma
Nikolas 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 Prisma
Nikolas Burk
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
Nikolas Burk
 
GraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & ContentfulGraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & Contentful
Nikolas 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 Cloud
Nikolas 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 & Prisma
Nikolas Burk
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018
Nikolas Burk
 
React & GraphQL
React & GraphQLReact & GraphQL
React & GraphQL
Nikolas Burk
 
Building Serverless GraphQL Backends
Building Serverless GraphQL BackendsBuilding Serverless GraphQL Backends
Building Serverless GraphQL Backends
Nikolas Burk
 
GraphQL Subscriptions
GraphQL SubscriptionsGraphQL Subscriptions
GraphQL Subscriptions
Nikolas Burk
 
The Serverless GraphQL Backend Architecture
The Serverless GraphQL Backend ArchitectureThe Serverless GraphQL Backend Architecture
The Serverless GraphQL Backend Architecture
Nikolas Burk
 
Diving into GraphQL, React & Apollo
Diving into GraphQL, React & ApolloDiving into GraphQL, React & Apollo
Diving into GraphQL, React & Apollo
Nikolas Burk
 
Authentication, Authorization & Error Handling with GraphQL
Authentication, Authorization & Error Handling with GraphQLAuthentication, Authorization & Error Handling with GraphQL
Authentication, Authorization & Error Handling with GraphQL
Nikolas Burk
 
Getting Started with Relay Modern
Getting Started with Relay ModernGetting Started with Relay Modern
Getting Started with Relay Modern
Nikolas 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 iOS
Nikolas Burk
 

More from 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
 

Recently uploaded

Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
Paul Brebner
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
anfaltahir1010
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
seospiralmantra
 
Benefits of Artificial Intelligence in Healthcare!
Benefits of  Artificial Intelligence in Healthcare!Benefits of  Artificial Intelligence in Healthcare!
Benefits of Artificial Intelligence in Healthcare!
Prestware
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
ISH Technologies
 

Recently uploaded (20)

Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
 
Benefits of Artificial Intelligence in Healthcare!
Benefits of  Artificial Intelligence in Healthcare!Benefits of  Artificial Intelligence in Healthcare!
Benefits of Artificial Intelligence in Healthcare!
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
 

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.