SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
@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

Mais conteúdo relacionado

Mais procurados

Car Price prediction final pdf1.docx
Car Price prediction final pdf1.docxCar Price prediction final pdf1.docx
Car Price prediction final pdf1.docxSUMITKUMARBEHERA11
 
WinRunner Training
WinRunner TrainingWinRunner Training
WinRunner Trainingsunny.deb
 
Food delivery application report
Food delivery application reportFood delivery application report
Food delivery application reportAshwinBicholiya
 
Exploratory Testing
Exploratory TestingExploratory Testing
Exploratory Testingsriks7
 
Agile Testing Process
Agile Testing ProcessAgile Testing Process
Agile Testing ProcessIntetics
 
New trends in testing automation
New trends in testing automationNew trends in testing automation
New trends in testing automationEran Kinsbrunner
 
Software Testing and Quality Assurance Assignment 2
Software Testing and Quality Assurance Assignment 2Software Testing and Quality Assurance Assignment 2
Software Testing and Quality Assurance Assignment 2Gurpreet singh
 
Android Project report on City Tourist Location based services (Shuja ul hassan)
Android Project report on City Tourist Location based services (Shuja ul hassan)Android Project report on City Tourist Location based services (Shuja ul hassan)
Android Project report on City Tourist Location based services (Shuja ul hassan)Shuja Hassan
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testingHimanshu
 
Software Project Management: Business Case
Software Project Management: Business CaseSoftware Project Management: Business Case
Software Project Management: Business CaseMinhas Kamal
 
Waterfall model in Software engineering
Waterfall model in Software engineeringWaterfall model in Software engineering
Waterfall model in Software engineeringEhtesham Mehmood
 
Software testing basic concepts
Software testing basic conceptsSoftware testing basic concepts
Software testing basic conceptsHưng Hoàng
 
Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)Priyanka Kapoor
 
TESTING STRATEGY.ppt
TESTING STRATEGY.pptTESTING STRATEGY.ppt
TESTING STRATEGY.pptFawazHussain4
 
Language translator
Language translatorLanguage translator
Language translatorSumitSumit26
 
Software testing-in-gurgaon
Software testing-in-gurgaonSoftware testing-in-gurgaon
Software testing-in-gurgaonAP EDUSOFT
 

Mais procurados (20)

Car Price prediction final pdf1.docx
Car Price prediction final pdf1.docxCar Price prediction final pdf1.docx
Car Price prediction final pdf1.docx
 
WinRunner Training
WinRunner TrainingWinRunner Training
WinRunner Training
 
Food delivery application report
Food delivery application reportFood delivery application report
Food delivery application report
 
Exploratory Testing
Exploratory TestingExploratory Testing
Exploratory Testing
 
STLC
STLCSTLC
STLC
 
Agile Testing Process
Agile Testing ProcessAgile Testing Process
Agile Testing Process
 
New trends in testing automation
New trends in testing automationNew trends in testing automation
New trends in testing automation
 
Software Testing and Quality Assurance Assignment 2
Software Testing and Quality Assurance Assignment 2Software Testing and Quality Assurance Assignment 2
Software Testing and Quality Assurance Assignment 2
 
Android Project report on City Tourist Location based services (Shuja ul hassan)
Android Project report on City Tourist Location based services (Shuja ul hassan)Android Project report on City Tourist Location based services (Shuja ul hassan)
Android Project report on City Tourist Location based services (Shuja ul hassan)
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testing
 
Software Development Process
Software Development ProcessSoftware Development Process
Software Development Process
 
Software Project Management: Business Case
Software Project Management: Business CaseSoftware Project Management: Business Case
Software Project Management: Business Case
 
Waterfall model in Software engineering
Waterfall model in Software engineeringWaterfall model in Software engineering
Waterfall model in Software engineering
 
Introduction to Software Test Automation
Introduction to Software Test AutomationIntroduction to Software Test Automation
Introduction to Software Test Automation
 
Software testing basic concepts
Software testing basic conceptsSoftware testing basic concepts
Software testing basic concepts
 
Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)Report on e-Notice App (An Android Application)
Report on e-Notice App (An Android Application)
 
TESTING STRATEGY.ppt
TESTING STRATEGY.pptTESTING STRATEGY.ppt
TESTING STRATEGY.ppt
 
Agile Methodology ppt
Agile Methodology pptAgile Methodology ppt
Agile Methodology ppt
 
Language translator
Language translatorLanguage translator
Language translator
 
Software testing-in-gurgaon
Software testing-in-gurgaonSoftware testing-in-gurgaon
Software testing-in-gurgaon
 

Semelhante a 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
 

Semelhante a 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
 

Mais 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
 

Mais 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
 

Último

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%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
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 

Último (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%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
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

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.