SlideShare a Scribd company logo
Application state 
tomas.kulich@vacuumlabs.com
Some background
What is application state
What is application state 
All the data that determines how application 
looks and how application behaves
Application state of a REST­based 
web­page 
typical REST architecture: 
● DB 
● session? 
● client's URL 
● cookies 
server 
client 
What about some JS widget?
Application state of a typical 
heterogeneous server/client app 
● some objects here and there 
● event listeners installed here and there 
● private attributes, local vars in hidden 
scopes, ... 
● DOM 
● plus all of the RESTfull stuff
function counter(init){ 
var curr=init; 
return function(){ 
return curr++; 
} 
}
What can REST teach us 
● state is concentrated in a very FEW places, 
everything else is a FUNCTION of state 
● state is accessible to many parts of code (although 
there should be some rules to who­can­do­what) 
● state is mutated in a “nice” way 
– ACID, transactions 
– it does not matter how many threads do we have 
● (plain) objects are poor in holding mutable state
Wait, but... 
● I shouldn't create objects? 
● I shouldn't manipulate DOM? 
● What CAN I do? 
● Can I even code, pleeeeease?
Data in 
DOM 
(pure 
jquery) 
Collection 
/ smart 
object 
(Backbone 
) 
Angular 
­ish 
scope / 
model 
In 
memory 
DB 
Signals, 
FRP 
Persistent 
Epochal 
state 
Query language poor good good perfect good good 
Reactivity no yes yes no yes yes 
­consistency 
N/A no quite 
good 
N/A perfect perfect 
­performance 
N/A good dirty 
checks 
N/A perfect perfect 
­transactional 
N/A no mostly 
yes 
N/A yes yes 
Accountability no ~yes no ~yes no ~yes 
Manipulation 
­dump 
hard easy hard easy hard easy 
­save 
/ load / time 
travel 
hard&cost 
ly 
costly hard&co 
stly 
costly quite fine fine
Data in 
DOM 
(pure 
jquery) 
Collection 
/ smart 
object 
(Backbone 
) 
Angular 
­ish 
scope / 
model 
In 
memory 
DB 
Signals, 
FRP 
Persistent 
Epochal 
state 
Query language 
Reactivity 
­consistency 
­performance 
­transactional 
Accountability 
Manipulation 
­dump 
­save 
/ load / time 
travel
Data in 
DOM 
(pure 
jquery) 
Collection 
/ smart 
object 
(Backbone 
) 
Angular 
­ish 
scope / 
model 
In 
memory 
DB 
Signals, 
FRP 
Persistent 
Epochal 
state
● Data in DOM (pure jQuery) 
● Some “smart” data structure, such as Backbone 
collection 
● Angular­ish 
scope 
● In memory DB 
● Signals, FRP 
● Persistent state, Epochal time model
var Player = Blackbone.Model.extend({ 
initialize: 
function(){ 
this.on( "change:name", this.changeName); 
this.on( "change:age", this.changeAge); 
}, 
changeName: 
function(prev, val, options){ 
// this is a glitch and it is BAD thing 
console.log("name: " + this.get("name") + 
"whole name: " + 
this.whole_name); 
this.set({'whole_name', this.name + ' '+ 
this.surname}); 
}, 
}); 
var daz = new Player( {name:"Gaz", age:33}); 
daz.set( {name:"Daz"});
Signals, FRP 
x'=x+1 
y'=y+1 
tot=x+y 
mouse click 
key press
FRP references 
● ELM language 
● a LOT of papers (Deprecating the Observer Pattern with Scala.React) 
● Angular approach: http://teropa.info/blog/2013/11/03/make­your­own­angular­part­1­scopes­and­digest. 
html
Query language 
Reactivity 
­consistency 
­performance 
­transactional 
Accountability 
Manipulation 
­dump 
­save 
/ load / time 
travel
Query language 
● direct working with objects (maps) 
– usually OK with some fine helpers 
● SQL, datalog, MongoDB QL
Reactivity/Observability 
● How do we address this in REST? 
– well, we don't.. 
– Typically, we refresh / poll
Reactivity: Consistency 
● Programmers deserves stability 
– aka: Programátori si zaslúžia istoty 
– can partially­updated 
state be observable? 
Glitches are bad.
Reactivity: transactional 
jozo.set({name: "jozin z bazin"}); 
jozo.set({age: 18}); // wanna get some naughty pics 
jozo.set({name: "jozo again"}); 
● How many notifications there'll be? 
● How many do we want? 
● Can we somehow perform all the changes as one atomical change?
var Player = Blackbone.Model.extend({ 
initialize: 
function(){ 
this.on( "change:name", this.changeName); 
this.on( "change:age", this.changeAge); 
}, 
changeName: 
function(prev, val, options){ 
// this is a glitch and it is BAD thing 
console.log("name: " + this.get("name") + 
"whole name: " + 
this.whole_name); 
this.set({'whole_name', this.name + ' '+ 
this.surname}); 
}, 
}); 
var daz = new Player( {name:"Gaz", age:33}); 
daz.set( {name:"Gaz"});
Reactivity: performance 
● Let var a={name: 'jozo', age: 16}; 
How to tell, that a changed? old_a===new_a? 
1. Encapsulate and intercept variable setters 
­may 
resolve in ugly API 
­this 
may still leave glitches there 
2. Perform dirty checking 
­React 
or Angular do this 
­performance 
may suffer
Accountability of changes 
● Who is responsible for changing of some piece of state? 
1. Anyone, who feels it's a good idea 
<input value = {{x | transform1}} > 
<input value = {{x | transform2}} > 
2. There exists a dedicated controller for this piece of state 
­such 
as Flux's store
Manipulation 
state.dump(); // EVERYTHING is here 
file.write(curr_state); 
// poor man's undo 
curr_state_index­­; 
var state = states[curr_state_index]; 
app.render(state);
Data in 
DOM 
(pure 
jquery) 
Collection 
/ smart 
object 
(Backbone 
) 
Angular 
­ish 
scope / 
model 
In 
memory 
DB 
Signals, 
FRP 
Persistent 
Epochal 
state 
Query language poor good good perfect good good 
Reactivity no yes yes no yes yes 
­consistency 
N/A no quite 
good 
N/A perfect perfect 
­performance 
N/A good dirty 
checks 
N/A perfect perfect 
­transactional 
N/A no mostly 
yes 
N/A yes yes 
Accountability no ~yes no ~yes no ~yes 
Manipulation 
­dump 
hard easy hard easy hard easy 
­save 
/ load / time 
travel 
hard&cost 
ly 
costly hard&co 
stly 
costly quite fine fine
http://www.infoq.com/presentations/Are­We­There­Yet­Rich­Hickey
Author: Rich Hickey
Thank you for your attention 
● this is not just about web anymore! 
● check out Dart User Group on FB

More Related Content

What's hot

Bottom-Line Web Services
Bottom-Line Web ServicesBottom-Line Web Services
Bottom-Line Web Services
Mohammed Makhlouf
 
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
Reactive.IO
 
Glance rebol
Glance rebolGlance rebol
Glance rebol
crazyaxe
 
The CQRS diet
The CQRS dietThe CQRS diet
The CQRS diet
Luismi Cavallé
 
Domain Driven Rails
Domain Driven RailsDomain Driven Rails
Domain Driven Rails
Yan Pritzker
 
Learn To Code: Introduction to c
Learn To Code: Introduction to cLearn To Code: Introduction to c
Learn To Code: Introduction to c
SadhanaParameswaran
 
Getting Groovy
Getting GroovyGetting Groovy
Getting Groovy
Adam Davis
 
Java scriptforjavadev part1
Java scriptforjavadev part1Java scriptforjavadev part1
Java scriptforjavadev part1
Makarand Bhatambarekar
 
Green Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native PerformanceGreen Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native Performance
Green Custard
 
Sharable of qualities of clean code
Sharable of qualities of clean codeSharable of qualities of clean code
Sharable of qualities of clean code
Eman Mohamed
 
Kotlin - A Programming Language
Kotlin - A Programming Language Kotlin - A Programming Language
Kotlin - A Programming Language
Mobio Solutions
 
Kotlin L → ∞
Kotlin L → ∞Kotlin L → ∞
Kotlin L → ∞
Abdellah SELASSI
 
Stockholm JAM September 2018
Stockholm JAM September 2018Stockholm JAM September 2018
Stockholm JAM September 2018
Andrey Devyatkin
 
Is boilerplate code really so bad?
Is boilerplate code really so bad?Is boilerplate code really so bad?
Is boilerplate code really so bad?
Trisha Gee
 
JavaScript Variables
JavaScript VariablesJavaScript Variables
JavaScript Variables
Charles Russell
 
React learning in the hard way
React   learning in the hard wayReact   learning in the hard way
React learning in the hard way
Chen Feldman
 
Thinking Functionally
Thinking FunctionallyThinking Functionally
Thinking Functionally
Piyush Katariya
 
Kotlin vs Java • Bapusaheb Patil • TechieAid Talk
Kotlin vs Java • Bapusaheb Patil • TechieAid TalkKotlin vs Java • Bapusaheb Patil • TechieAid Talk
Kotlin vs Java • Bapusaheb Patil • TechieAid Talk
Bapusaheb Patil
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional way
Thoughtworks
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languages
Mikhail Barash
 

What's hot (20)

Bottom-Line Web Services
Bottom-Line Web ServicesBottom-Line Web Services
Bottom-Line Web Services
 
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
 
Glance rebol
Glance rebolGlance rebol
Glance rebol
 
The CQRS diet
The CQRS dietThe CQRS diet
The CQRS diet
 
Domain Driven Rails
Domain Driven RailsDomain Driven Rails
Domain Driven Rails
 
Learn To Code: Introduction to c
Learn To Code: Introduction to cLearn To Code: Introduction to c
Learn To Code: Introduction to c
 
Getting Groovy
Getting GroovyGetting Groovy
Getting Groovy
 
Java scriptforjavadev part1
Java scriptforjavadev part1Java scriptforjavadev part1
Java scriptforjavadev part1
 
Green Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native PerformanceGreen Custard Friday Talk 5: React-Native Performance
Green Custard Friday Talk 5: React-Native Performance
 
Sharable of qualities of clean code
Sharable of qualities of clean codeSharable of qualities of clean code
Sharable of qualities of clean code
 
Kotlin - A Programming Language
Kotlin - A Programming Language Kotlin - A Programming Language
Kotlin - A Programming Language
 
Kotlin L → ∞
Kotlin L → ∞Kotlin L → ∞
Kotlin L → ∞
 
Stockholm JAM September 2018
Stockholm JAM September 2018Stockholm JAM September 2018
Stockholm JAM September 2018
 
Is boilerplate code really so bad?
Is boilerplate code really so bad?Is boilerplate code really so bad?
Is boilerplate code really so bad?
 
JavaScript Variables
JavaScript VariablesJavaScript Variables
JavaScript Variables
 
React learning in the hard way
React   learning in the hard wayReact   learning in the hard way
React learning in the hard way
 
Thinking Functionally
Thinking FunctionallyThinking Functionally
Thinking Functionally
 
Kotlin vs Java • Bapusaheb Patil • TechieAid Talk
Kotlin vs Java • Bapusaheb Patil • TechieAid TalkKotlin vs Java • Bapusaheb Patil • TechieAid Talk
Kotlin vs Java • Bapusaheb Patil • TechieAid Talk
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional way
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languages
 

Viewers also liked

(Technical paper) Cis utilization of earned value management for monitoring p...
(Technical paper) Cis utilization of earned value management for monitoring p...(Technical paper) Cis utilization of earned value management for monitoring p...
(Technical paper) Cis utilization of earned value management for monitoring p...
Скоробогатов Дмитрий
 
Civil War - Looking into the details
Civil War - Looking into the detailsCivil War - Looking into the details
Civil War - Looking into the details
Mikespurelife
 
Quality analysis of NSF DMP plans - Wayne State University
Quality analysis of NSF DMP plans - Wayne State UniversityQuality analysis of NSF DMP plans - Wayne State University
Quality analysis of NSF DMP plans - Wayne State University
rds-wayne-edu
 
How do business organizations manage change?, why is it usually resisted?
How do business organizations manage change?, why is it usually resisted?How do business organizations manage change?, why is it usually resisted?
How do business organizations manage change?, why is it usually resisted?
Sirajo Danhassan
 
Library resources and services for grant development
Library resources and services for grant developmentLibrary resources and services for grant development
Library resources and services for grant development
rds-wayne-edu
 
Operation 7
Operation 7Operation 7
Operation 7
haribabu2711
 
книги-юбиляры 2016 года
книги-юбиляры 2016 годакниги-юбиляры 2016 года
книги-юбиляры 2016 года
Julia Kuvshinova
 
книги-юбиляры 2016
книги-юбиляры 2016книги-юбиляры 2016
книги-юбиляры 2016
Julia Kuvshinova
 
Rural Exposure
Rural ExposureRural Exposure
Rural Exposure
Priti Rose Kullu
 
Introduction to research data management
Introduction to research data managementIntroduction to research data management
Introduction to research data managementrds-wayne-edu
 
Vivero ciudadela
Vivero ciudadelaVivero ciudadela
Vivero ciudadela
Viverociudadela2014
 

Viewers also liked (11)

(Technical paper) Cis utilization of earned value management for monitoring p...
(Technical paper) Cis utilization of earned value management for monitoring p...(Technical paper) Cis utilization of earned value management for monitoring p...
(Technical paper) Cis utilization of earned value management for monitoring p...
 
Civil War - Looking into the details
Civil War - Looking into the detailsCivil War - Looking into the details
Civil War - Looking into the details
 
Quality analysis of NSF DMP plans - Wayne State University
Quality analysis of NSF DMP plans - Wayne State UniversityQuality analysis of NSF DMP plans - Wayne State University
Quality analysis of NSF DMP plans - Wayne State University
 
How do business organizations manage change?, why is it usually resisted?
How do business organizations manage change?, why is it usually resisted?How do business organizations manage change?, why is it usually resisted?
How do business organizations manage change?, why is it usually resisted?
 
Library resources and services for grant development
Library resources and services for grant developmentLibrary resources and services for grant development
Library resources and services for grant development
 
Operation 7
Operation 7Operation 7
Operation 7
 
книги-юбиляры 2016 года
книги-юбиляры 2016 годакниги-юбиляры 2016 года
книги-юбиляры 2016 года
 
книги-юбиляры 2016
книги-юбиляры 2016книги-юбиляры 2016
книги-юбиляры 2016
 
Rural Exposure
Rural ExposureRural Exposure
Rural Exposure
 
Introduction to research data management
Introduction to research data managementIntroduction to research data management
Introduction to research data management
 
Vivero ciudadela
Vivero ciudadelaVivero ciudadela
Vivero ciudadela
 

Similar to Appstate

High Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptHigh Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScript
Leonardo Borges
 
The Road To Redux
The Road To ReduxThe Road To Redux
The Road To Redux
Jeffrey Sanchez
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with Redux
FITC
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
Jorg Janke
 
An Intro to Scala for PHP Developers
An Intro to Scala for PHP DevelopersAn Intro to Scala for PHP Developers
An Intro to Scala for PHP Developers
HuffPost Code
 
ClojureScript Introduction
ClojureScript IntroductionClojureScript Introduction
ClojureScript Introduction
Falko Riemenschneider
 
Got bored by the relational database? Switch to a RDF store!
Got bored by the relational database? Switch to a RDF store!Got bored by the relational database? Switch to a RDF store!
Got bored by the relational database? Switch to a RDF store!
benfante
 
Globant development week / React Redux Rorkshop
Globant development week / React Redux RorkshopGlobant development week / React Redux Rorkshop
Globant development week / React Redux Rorkshop
Globant
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
Jumping Bean
 
Php melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddyPhp melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddy
Douglas Reith
 
Building a Database for the End of the World
Building a Database for the End of the WorldBuilding a Database for the End of the World
Building a Database for the End of the World
jhugg
 
It's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda ArchitectureIt's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda Architecture
Yaroslav Tkachenko
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very ugly
Bozhidar Bozhanov
 
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, ShopifyIt's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
HostedbyConfluent
 
Introduction to Erlang Programming Language
Introduction to Erlang Programming LanguageIntroduction to Erlang Programming Language
Introduction to Erlang Programming Language
Yasas Gunarathne
 
IBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons LearnedIBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons LearnedTed Leung
 
Zenly - Reverse geocoding
Zenly - Reverse geocodingZenly - Reverse geocoding
Zenly - Reverse geocoding
CocoaHeads France
 
MongoDB 2.8 Replication Internals: Fitting it all together
MongoDB 2.8 Replication Internals: Fitting it all togetherMongoDB 2.8 Replication Internals: Fitting it all together
MongoDB 2.8 Replication Internals: Fitting it all together
Scott Hernandez
 
Replication Internals: Fitting Everything Together
Replication Internals: Fitting Everything TogetherReplication Internals: Fitting Everything Together
Replication Internals: Fitting Everything Together
MongoDB
 
Node.js streams talk
Node.js streams talkNode.js streams talk
Node.js streams talk
zladuric
 

Similar to Appstate (20)

High Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptHigh Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScript
 
The Road To Redux
The Road To ReduxThe Road To Redux
The Road To Redux
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with Redux
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
An Intro to Scala for PHP Developers
An Intro to Scala for PHP DevelopersAn Intro to Scala for PHP Developers
An Intro to Scala for PHP Developers
 
ClojureScript Introduction
ClojureScript IntroductionClojureScript Introduction
ClojureScript Introduction
 
Got bored by the relational database? Switch to a RDF store!
Got bored by the relational database? Switch to a RDF store!Got bored by the relational database? Switch to a RDF store!
Got bored by the relational database? Switch to a RDF store!
 
Globant development week / React Redux Rorkshop
Globant development week / React Redux RorkshopGlobant development week / React Redux Rorkshop
Globant development week / React Redux Rorkshop
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
 
Php melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddyPhp melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddy
 
Building a Database for the End of the World
Building a Database for the End of the WorldBuilding a Database for the End of the World
Building a Database for the End of the World
 
It's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda ArchitectureIt's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda Architecture
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very ugly
 
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, ShopifyIt's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
It's Time To Stop Using Lambda Architecture | Yaroslav Tkachenko, Shopify
 
Introduction to Erlang Programming Language
Introduction to Erlang Programming LanguageIntroduction to Erlang Programming Language
Introduction to Erlang Programming Language
 
IBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons LearnedIBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons Learned
 
Zenly - Reverse geocoding
Zenly - Reverse geocodingZenly - Reverse geocoding
Zenly - Reverse geocoding
 
MongoDB 2.8 Replication Internals: Fitting it all together
MongoDB 2.8 Replication Internals: Fitting it all togetherMongoDB 2.8 Replication Internals: Fitting it all together
MongoDB 2.8 Replication Internals: Fitting it all together
 
Replication Internals: Fitting Everything Together
Replication Internals: Fitting Everything TogetherReplication Internals: Fitting Everything Together
Replication Internals: Fitting Everything Together
 
Node.js streams talk
Node.js streams talkNode.js streams talk
Node.js streams talk
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 

Appstate

  • 4. What is application state All the data that determines how application looks and how application behaves
  • 5. Application state of a REST­based web­page typical REST architecture: ● DB ● session? ● client's URL ● cookies server client What about some JS widget?
  • 6. Application state of a typical heterogeneous server/client app ● some objects here and there ● event listeners installed here and there ● private attributes, local vars in hidden scopes, ... ● DOM ● plus all of the RESTfull stuff
  • 7. function counter(init){ var curr=init; return function(){ return curr++; } }
  • 8.
  • 9.
  • 10. What can REST teach us ● state is concentrated in a very FEW places, everything else is a FUNCTION of state ● state is accessible to many parts of code (although there should be some rules to who­can­do­what) ● state is mutated in a “nice” way – ACID, transactions – it does not matter how many threads do we have ● (plain) objects are poor in holding mutable state
  • 11. Wait, but... ● I shouldn't create objects? ● I shouldn't manipulate DOM? ● What CAN I do? ● Can I even code, pleeeeease?
  • 12. Data in DOM (pure jquery) Collection / smart object (Backbone ) Angular ­ish scope / model In memory DB Signals, FRP Persistent Epochal state Query language poor good good perfect good good Reactivity no yes yes no yes yes ­consistency N/A no quite good N/A perfect perfect ­performance N/A good dirty checks N/A perfect perfect ­transactional N/A no mostly yes N/A yes yes Accountability no ~yes no ~yes no ~yes Manipulation ­dump hard easy hard easy hard easy ­save / load / time travel hard&cost ly costly hard&co stly costly quite fine fine
  • 13. Data in DOM (pure jquery) Collection / smart object (Backbone ) Angular ­ish scope / model In memory DB Signals, FRP Persistent Epochal state Query language Reactivity ­consistency ­performance ­transactional Accountability Manipulation ­dump ­save / load / time travel
  • 14. Data in DOM (pure jquery) Collection / smart object (Backbone ) Angular ­ish scope / model In memory DB Signals, FRP Persistent Epochal state
  • 15. ● Data in DOM (pure jQuery) ● Some “smart” data structure, such as Backbone collection ● Angular­ish scope ● In memory DB ● Signals, FRP ● Persistent state, Epochal time model
  • 16. var Player = Blackbone.Model.extend({ initialize: function(){ this.on( "change:name", this.changeName); this.on( "change:age", this.changeAge); }, changeName: function(prev, val, options){ // this is a glitch and it is BAD thing console.log("name: " + this.get("name") + "whole name: " + this.whole_name); this.set({'whole_name', this.name + ' '+ this.surname}); }, }); var daz = new Player( {name:"Gaz", age:33}); daz.set( {name:"Daz"});
  • 17. Signals, FRP x'=x+1 y'=y+1 tot=x+y mouse click key press
  • 18. FRP references ● ELM language ● a LOT of papers (Deprecating the Observer Pattern with Scala.React) ● Angular approach: http://teropa.info/blog/2013/11/03/make­your­own­angular­part­1­scopes­and­digest. html
  • 19. Query language Reactivity ­consistency ­performance ­transactional Accountability Manipulation ­dump ­save / load / time travel
  • 20. Query language ● direct working with objects (maps) – usually OK with some fine helpers ● SQL, datalog, MongoDB QL
  • 21. Reactivity/Observability ● How do we address this in REST? – well, we don't.. – Typically, we refresh / poll
  • 22. Reactivity: Consistency ● Programmers deserves stability – aka: Programátori si zaslúžia istoty – can partially­updated state be observable? Glitches are bad.
  • 23. Reactivity: transactional jozo.set({name: "jozin z bazin"}); jozo.set({age: 18}); // wanna get some naughty pics jozo.set({name: "jozo again"}); ● How many notifications there'll be? ● How many do we want? ● Can we somehow perform all the changes as one atomical change?
  • 24. var Player = Blackbone.Model.extend({ initialize: function(){ this.on( "change:name", this.changeName); this.on( "change:age", this.changeAge); }, changeName: function(prev, val, options){ // this is a glitch and it is BAD thing console.log("name: " + this.get("name") + "whole name: " + this.whole_name); this.set({'whole_name', this.name + ' '+ this.surname}); }, }); var daz = new Player( {name:"Gaz", age:33}); daz.set( {name:"Gaz"});
  • 25. Reactivity: performance ● Let var a={name: 'jozo', age: 16}; How to tell, that a changed? old_a===new_a? 1. Encapsulate and intercept variable setters ­may resolve in ugly API ­this may still leave glitches there 2. Perform dirty checking ­React or Angular do this ­performance may suffer
  • 26. Accountability of changes ● Who is responsible for changing of some piece of state? 1. Anyone, who feels it's a good idea <input value = {{x | transform1}} > <input value = {{x | transform2}} > 2. There exists a dedicated controller for this piece of state ­such as Flux's store
  • 27. Manipulation state.dump(); // EVERYTHING is here file.write(curr_state); // poor man's undo curr_state_index­­; var state = states[curr_state_index]; app.render(state);
  • 28. Data in DOM (pure jquery) Collection / smart object (Backbone ) Angular ­ish scope / model In memory DB Signals, FRP Persistent Epochal state Query language poor good good perfect good good Reactivity no yes yes no yes yes ­consistency N/A no quite good N/A perfect perfect ­performance N/A good dirty checks N/A perfect perfect ­transactional N/A no mostly yes N/A yes yes Accountability no ~yes no ~yes no ~yes Manipulation ­dump hard easy hard easy hard easy ­save / load / time travel hard&cost ly costly hard&co stly costly quite fine fine
  • 31.
  • 32.
  • 33. Thank you for your attention ● this is not just about web anymore! ● check out Dart User Group on FB