SlideShare a Scribd company logo
Thin client SPAs?
Stream UI using web standards
MARCIN WARPECHOWSKI, STARCOUNTER
CODENIGHT
STOCKHOLM, 2016-06-09
Agenda
- discuss fat vs thin client architectural styles of web apps
- present a thin client pattern and library called “PuppetJs”
- show some code
- questions all the time
github.com/puppetjs/puppetjs
codenight.mysampleapp.com
Fat client SPAs
STATELESS STATE #2STATE #1
SERVER APP CLIENT APP
REST
INTERFACE
JSON
REST
CLIENT
Typical problems in REST and ROA
- Long-running transactions. I want to work in isolation until I am
ready to commit or roll back my changes.

- Data redundancy. I don’t want to send or get more information
than needed.

- Cache invalidation. I want to work on current state.
Problems of fat client
- heavy code
- duplicate logic
- increased complexity
- validation on both ends
- glue code
Thin client should be among the considered
solutions
nyctaxi.herokuapp.com
Pattern for data synchronization.
Uses JSON and JSON-Patch over
HTTP and WebSocket.
PuppetJs
Standards
PuppetJs
Pattern for data synchronization.
Uses JSON and JSON-Patch over
HTTP and WebSocket.
S T A T E
SERVER APP
WITH VIEW-MODEL
JSON VIEW
PuppetJs binds server-side view-models to HTML
Puppet flow
Demo time
JSON is low-res
- JSON has just 6 types of value:
- string
- number
- boolean
- null
- object
- array
PRIMITIVE
COMPOSITE
What UI can you represent with JSON?
- text labels and inputs
- URLs
- Markdown
- HTML
- amounts
- buttons
- geographic coordinates
- checkboxes
- toggle buttons
- disabled inputs
- conditional displaying of things
STRING
NUMBER
BOOLEAN
What UI can you represent with JSON?
- nested views
- namespaces
- lists of values
- lists of views
OBJECT
ARRAY
Benefits to productivity
- no client side app, no glue code between apps
- works great with JavaScript and Web Components
- composable nested views
Benefits to performance and UX
- morphing views
- real-time view of the data
- client patches mitigate network latency
Benefits to integrity
- security
- server is the single source of truth
Challenges for thin client
- connection
- latency
- going out of sync
Connection: always ON
- already true for POS, e-commerce, social media, etc
- already true for remote desktop
- solution: have a server on premise, replicate the DB to a master
server
Sthlm-Frankfurt-Sthlm in 42 ms
Meaning: 23 roundtrips per second
In 200 ms to NY and back
Meaning: 5 roundtrips per second
Latency mitigation
- horizontal partitioning “sharding” - (moving ownership of the
rows)
- replication
Going out of sync?
• web reality: the client and the server are doing concurrent
changes asynchronously (most of the time out-of-sync)
• goal: apply patches correctly without freezing UI or disallowing
server push
• solution: Operational Transformation - algorithm that
transforms any remote operation over operations that were
generated locally
Without Operational Transformation
CLIENT SERVER
“ABCDE” “ABCDE”
“ABCE” “ACDE”
“ACD”“ACE”
C = Del 4 S = Del 2
S = Del 2 C = Del 4
TIME
With Operational Transformation
CLIENT SERVER
TIME
“ABCDE” “ABCDE”
“ABCE” “ACDE”
“ACD”“ACE”
C = Del 4 S = Del 2
S’ = Del 2 C’ = Del 3
Puppet implementations
JavaScript: github.com/puppetjs/puppetjs
Web Components: github.com/PuppetJs/puppet-polymer-client
C#: github.com/starcounter/starcounter
Sample apps:
Hello World: github.com/warpech/HelloWorld
KitchenSink: github.com/StarcounterSamples/KitchenSink
Thanks! More info on
.io
Twitter: @starcounterdb, @warpech

More Related Content

PDF
Thin client SPAs. Stream UI using web standards
PDF
Building Asynchronous Microservices with Armeria
PPTX
Wordcamp2009
PPT
Zing Database – Distributed Key-Value Database
PDF
Jayway Web Tech Radar 2015
PDF
Introduction to Web Sockets
PPT
How to push data to a browser
Thin client SPAs. Stream UI using web standards
Building Asynchronous Microservices with Armeria
Wordcamp2009
Zing Database – Distributed Key-Value Database
Jayway Web Tech Radar 2015
Introduction to Web Sockets
How to push data to a browser

What's hot (20)

PPTX
Web Sockets
PPTX
Rapid Application Development with MEAN Stack
PDF
The MEAN stack - SoCalCodeCamp - june 29th 2014
PPT
ZaloPay Merchant Platform on K8S on-premise
PDF
Headless Magento - Meet Magento Poland 2017
PDF
Headless approach for offloading heavy tasks in Magento
PDF
A Gentle Introduction to Functions-as-a-Service
PPTX
Mciro Services & Zookeeper
PPTX
A faster web
PDF
Scaling a Web Service
PDF
PAC 2019 virtual Mark Tomlinson
PDF
Thin Server Architecture SPA, 5 years old presentation
PDF
Wcf remaining
PDF
React Introduction
KEY
Thin Server Architecture
PPT
VFP & Ajax
PDF
Single Page Apps
PPTX
Experience lessons from architecture of zalo real time system
ODP
Compress
PDF
2deHands.be - Tuning a Big Classifieds Site
Web Sockets
Rapid Application Development with MEAN Stack
The MEAN stack - SoCalCodeCamp - june 29th 2014
ZaloPay Merchant Platform on K8S on-premise
Headless Magento - Meet Magento Poland 2017
Headless approach for offloading heavy tasks in Magento
A Gentle Introduction to Functions-as-a-Service
Mciro Services & Zookeeper
A faster web
Scaling a Web Service
PAC 2019 virtual Mark Tomlinson
Thin Server Architecture SPA, 5 years old presentation
Wcf remaining
React Introduction
Thin Server Architecture
VFP & Ajax
Single Page Apps
Experience lessons from architecture of zalo real time system
Compress
2deHands.be - Tuning a Big Classifieds Site
Ad

Viewers also liked (13)

PDF
PPTX
Internship
PPTX
Tim Mann, CIO at NFU Mutual - Digital Transformation Case Studies: how NFUM i...
PPTX
Sumendiak
PDF
If you drink, floome
PPTX
Slideshare test
PDF
лыхмус анастасии
PDF
vsource brochure
KEY
Nervous system
PPT
스포츠토토추천〔⊙°⊙〕PuPu82,coM〔⊙°⊙〕 스타배팅 스타토토
PDF
Technology Primer: Monitor Microservices, Containers, Cloud Foundry and Node ...
PPTX
Primary Data VMworld 2015 VVOLs Survey Key Findings
PPT
performance evaluation of desilting devices
Internship
Tim Mann, CIO at NFU Mutual - Digital Transformation Case Studies: how NFUM i...
Sumendiak
If you drink, floome
Slideshare test
лыхмус анастасии
vsource brochure
Nervous system
스포츠토토추천〔⊙°⊙〕PuPu82,coM〔⊙°⊙〕 스타배팅 스타토토
Technology Primer: Monitor Microservices, Containers, Cloud Foundry and Node ...
Primary Data VMworld 2015 VVOLs Survey Key Findings
performance evaluation of desilting devices
Ad

Similar to Thin client SPAs? Stream UI using web standards (CodeNight) (20)

PDF
Practical Thin Server Architecture With Dojo Peter Svensson
PDF
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
PDF
JavaScript Service Worker Design Patterns for Better User Experience
PDF
Expressing your UI in JSON – plain, data binding, advanced data binding
PDF
Puppet – Make stateful apps easier than stateless
PDF
Service worker API
PPTX
Raising ux bar with offline first design
PDF
Service workers are your best friends
PDF
A year with progressive web apps! #DevConMU
PPT
Krug Fat Client
PPT
IBM and Node.js - Old Doge, New Tricks
PPTX
Scalable Architectures - Microsoft Finland DevDays 2014
PDF
Next Generation Web Development Techniques with Cloud Foundry
PDF
Real Time Web - What's that for?
PDF
Always on! Or not?
PDF
A year with progressive web apps! #webinale
PDF
Atmosphere 2014: Switching from monolithic approach to modular cloud computin...
PDF
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load Times
PDF
Building and Scaling a WebSockets Pubsub System
KEY
Synchronous Reads Asynchronous Writes RubyConf 2009
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
JavaScript Service Worker Design Patterns for Better User Experience
Expressing your UI in JSON – plain, data binding, advanced data binding
Puppet – Make stateful apps easier than stateless
Service worker API
Raising ux bar with offline first design
Service workers are your best friends
A year with progressive web apps! #DevConMU
Krug Fat Client
IBM and Node.js - Old Doge, New Tricks
Scalable Architectures - Microsoft Finland DevDays 2014
Next Generation Web Development Techniques with Cloud Foundry
Real Time Web - What's that for?
Always on! Or not?
A year with progressive web apps! #webinale
Atmosphere 2014: Switching from monolithic approach to modular cloud computin...
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load Times
Building and Scaling a WebSockets Pubsub System
Synchronous Reads Asynchronous Writes RubyConf 2009

Recently uploaded (20)

PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPT
Mechanical Engineering MATERIALS Selection
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
Sustainable Sites - Green Building Construction
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
UNIT 4 Total Quality Management .pptx
DOCX
573137875-Attendance-Management-System-original
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
Construction Project Organization Group 2.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPT
Project quality management in manufacturing
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Geodesy 1.pptx...............................................
OOP with Java - Java Introduction (Basics)
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Mechanical Engineering MATERIALS Selection
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Sustainable Sites - Green Building Construction
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
UNIT 4 Total Quality Management .pptx
573137875-Attendance-Management-System-original
III.4.1.2_The_Space_Environment.p pdffdf
Construction Project Organization Group 2.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
Project quality management in manufacturing
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf

Thin client SPAs? Stream UI using web standards (CodeNight)

  • 1. Thin client SPAs? Stream UI using web standards MARCIN WARPECHOWSKI, STARCOUNTER CODENIGHT STOCKHOLM, 2016-06-09
  • 2. Agenda - discuss fat vs thin client architectural styles of web apps - present a thin client pattern and library called “PuppetJs” - show some code - questions all the time github.com/puppetjs/puppetjs codenight.mysampleapp.com
  • 3. Fat client SPAs STATELESS STATE #2STATE #1 SERVER APP CLIENT APP REST INTERFACE JSON REST CLIENT
  • 4. Typical problems in REST and ROA - Long-running transactions. I want to work in isolation until I am ready to commit or roll back my changes.
 - Data redundancy. I don’t want to send or get more information than needed.
 - Cache invalidation. I want to work on current state.
  • 5. Problems of fat client - heavy code - duplicate logic - increased complexity - validation on both ends - glue code
  • 6. Thin client should be among the considered solutions nyctaxi.herokuapp.com
  • 7. Pattern for data synchronization. Uses JSON and JSON-Patch over HTTP and WebSocket. PuppetJs
  • 8. Standards PuppetJs Pattern for data synchronization. Uses JSON and JSON-Patch over HTTP and WebSocket.
  • 9. S T A T E SERVER APP WITH VIEW-MODEL JSON VIEW PuppetJs binds server-side view-models to HTML
  • 12. JSON is low-res - JSON has just 6 types of value: - string - number - boolean - null - object - array PRIMITIVE COMPOSITE
  • 13. What UI can you represent with JSON? - text labels and inputs - URLs - Markdown - HTML - amounts - buttons - geographic coordinates - checkboxes - toggle buttons - disabled inputs - conditional displaying of things STRING NUMBER BOOLEAN
  • 14. What UI can you represent with JSON? - nested views - namespaces - lists of values - lists of views OBJECT ARRAY
  • 15. Benefits to productivity - no client side app, no glue code between apps - works great with JavaScript and Web Components - composable nested views
  • 16. Benefits to performance and UX - morphing views - real-time view of the data - client patches mitigate network latency
  • 17. Benefits to integrity - security - server is the single source of truth
  • 18. Challenges for thin client - connection - latency - going out of sync
  • 19. Connection: always ON - already true for POS, e-commerce, social media, etc - already true for remote desktop - solution: have a server on premise, replicate the DB to a master server
  • 20. Sthlm-Frankfurt-Sthlm in 42 ms Meaning: 23 roundtrips per second
  • 21. In 200 ms to NY and back Meaning: 5 roundtrips per second
  • 22. Latency mitigation - horizontal partitioning “sharding” - (moving ownership of the rows) - replication
  • 23. Going out of sync? • web reality: the client and the server are doing concurrent changes asynchronously (most of the time out-of-sync) • goal: apply patches correctly without freezing UI or disallowing server push • solution: Operational Transformation - algorithm that transforms any remote operation over operations that were generated locally
  • 24. Without Operational Transformation CLIENT SERVER “ABCDE” “ABCDE” “ABCE” “ACDE” “ACD”“ACE” C = Del 4 S = Del 2 S = Del 2 C = Del 4 TIME
  • 25. With Operational Transformation CLIENT SERVER TIME “ABCDE” “ABCDE” “ABCE” “ACDE” “ACD”“ACE” C = Del 4 S = Del 2 S’ = Del 2 C’ = Del 3
  • 26. Puppet implementations JavaScript: github.com/puppetjs/puppetjs Web Components: github.com/PuppetJs/puppet-polymer-client C#: github.com/starcounter/starcounter Sample apps: Hello World: github.com/warpech/HelloWorld KitchenSink: github.com/StarcounterSamples/KitchenSink
  • 27. Thanks! More info on .io Twitter: @starcounterdb, @warpech