SlideShare a Scribd company logo
Clients in control
building demand-driven
systems with Om Next
Craft Conf 2016
@anmonteiro90
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om Next
REST: expectations
• define logical “resources”
• identified by URIs
• clients request them
REST: reality
• only able to request trivial data
• “joined” resources
• bloat endpoint?
• multiple requests?
– Roy T. Fielding, PhD
“The REST interface is designed to be efficient
for large-grain hypermedia data transfer, […]
resulting in an interface that is not optimal for
other forms of architectural interaction.”
REST
REST
REST
REST
– Roy T. Fielding, PhD
“The trade-off, though, is that a uniform interface
degrades efficiency, since information is
transferred in a standardized form rather than
one which is specific to an application's needs.”
Luke Wroblewski
How to write a service that
meets the varying demands
of heterogeneous clients?
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om Next
Let’s keep looking…
Clients in control: building demand-driven systems with Om Next
Desirable properties
• clients can request the exact total
response they need
• clients can communicate novelty
atomically
• without sacrificing relational queries on
the server
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om Next
Checkpoint
• How to make precise
requests?
• Client
• Server
• How do clients
communicate novelty?
• Communicate identity
back to client?
• Communication over the
wire?
• Client-only state
• Testing
• Caching
• Pluggable client / server
storage?
Transit
Enter Om Next…
Om Next opinions
• Single source of truth
• Minimize flushing to DOM
• Abstract asynchrony
• No (visible) event model
Clients in control: building demand-driven systems with Om Next
[:person/name]
(defui Person
static om/IQuery
(query [this]
[:person/name])
Object
(render [this]
...))
Query expressions
:person/name
(:person/friends {:sort :asc})
{:person/address
[:address/street :address/zip]}
Query expressions
(increment/users!)
(delete/friend! {:me 1 :friend 2})
Parser
• Evaluates query expressions
• Hydrates queries
• no reshaping!
Parser
[:person/name]
{:person/name “António”}
Parser
• Runs on the client and server
• Runs reads and mutations
Demo
[(person/add!
{:person/name “António”
:person/address
{:address/street “Hochschulstraße”
:address/zip “01069”}})]
[(delete/friend! {:me 1
:friend 2})
:friends/list]
Re-read this key
Creating information
• Create temporary information on
client
• Remote mutation hits server
• Server replies with mappings
• tempids → real ids
Clients in control: building demand-driven systems with Om Next
Client-only state
• First-class support
• Storage: merged with remote state
• Parser distinguishes local / server
• knows how to pick remote queries
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om Next
Normalization
• Also in Relay, Falcor
• Om Next can automatically
• Normalize
• Denormalize
{:people [{:person/name “Alice”
:person/age 25}
{:person/name “Bob”
:person/age 34}]
:favorites [{:person/name “Bob”
:person/age 34}]}
{:people
[[:person/by-name “Alice”]
[:person/by-name “Bob”]]
:favorites
[[:person/by-name “Bob”]]
:person/by-name
{“Alice” {:person/name “Alice”
:person/age 25}
“Bob” {:person/name “Bob”
:person/age 34}}}
Clients in control: building demand-driven systems with Om Next
Testing
• global app state + immutability = awesome
• Parser abstraction = 1 place
• React = pure function
• f ( data ) = UI
• We can just test the UI data tree!
Property-based testing
• example-based
• specify input / output pairs
• property-based
• write invariants
• generate random tests
• attempt to falsify invariants
• shrinking
Om Next + test.check
• queries / mutations are data
• generate transactions
• run against the parser
• check invariants in resulting state
Demo
Testing recap
1. Generate random transactions
2. Shrink failures
3. Use minimal failure to
reproduce bugs
1. Generate random transactions
2. Shrink failures
3. Use minimal failure to
reproduce bugs
Testing recap
More Om Next
• Recursive UIs
• Heterogeneous UIs
• HTTP Caching
• Custom client side storage
• Streaming
Server
• Clojure preferred / less boilerplate
• Other languages need to implement
parser logic
• easier for languages with Transit
implementation
• Datomic rocks
• some people using other DBs
Project status
• very close to beta
• documentation
• github.com/omcljs/om/wiki
• awkay.github.io/om-tutorial/
• anmonteiro.com
Takeaways
• we can radically simplify UI
programming
• Regardless of library / framework
• your system should support
these properties
– Rich Hickey
“Programmers know the benefits of everything
and the tradeoffs of nothing”
github.com/anmonteiro/craftconf-demo/
Questions?

More Related Content

PPTX
Austin Day of Rest - Introduction
PDF
5. Your Crossref questions answered
PPTX
Are Transactions Right For You? Using and Not Abusing Transactions
PPTX
RESTful API Design: Illustrated
PPTX
Декоративные шнуры
PDF
Patterns
PPTX
Demand driven applications with om.next and react native
PPTX
RESTful Services
Austin Day of Rest - Introduction
5. Your Crossref questions answered
Are Transactions Right For You? Using and Not Abusing Transactions
RESTful API Design: Illustrated
Декоративные шнуры
Patterns
Demand driven applications with om.next and react native
RESTful Services

Similar to Clients in control: building demand-driven systems with Om Next (20)

PDF
Api Penetration Testing and web app pentesting
PPTX
An Overview of Web Services: SOAP and REST
PPTX
A Real-World Implementation of Linked Data
KEY
mongoDB at Visibiz
KEY
Building with linked_in_api
PPTX
REST API Design
PDF
Cassandra Summit 2014: Fuzzy Entity Matching at Scale
PPTX
CakeFest 2013 - A-Z REST APIs
PPTX
CakeFest 2013 - A-Z REST APIs
PDF
Introduction to Restful Web Services
PDF
The never-ending REST API design debate
PDF
RESTful web
PDF
REST and REST-fulness
PPTX
Why do they call it Linked Data when they want to say...?
PPTX
APIs in Enterprise
PPTX
NISO/DCMI May 22 Webinar: Semantic Mashups Across Large, Heterogeneous Insti...
PPTX
Lies you have been told about REST
KEY
ALA Midwinter 2011 Holdings Update
PDF
The never-ending REST API design debate -- Devoxx France 2016
PDF
On being RESTful
Api Penetration Testing and web app pentesting
An Overview of Web Services: SOAP and REST
A Real-World Implementation of Linked Data
mongoDB at Visibiz
Building with linked_in_api
REST API Design
Cassandra Summit 2014: Fuzzy Entity Matching at Scale
CakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIs
Introduction to Restful Web Services
The never-ending REST API design debate
RESTful web
REST and REST-fulness
Why do they call it Linked Data when they want to say...?
APIs in Enterprise
NISO/DCMI May 22 Webinar: Semantic Mashups Across Large, Heterogeneous Insti...
Lies you have been told about REST
ALA Midwinter 2011 Holdings Update
The never-ending REST API design debate -- Devoxx France 2016
On being RESTful
Ad

Recently uploaded (20)

PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Nekopoi APK 2025 free lastest update
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Introduction to Artificial Intelligence
PPTX
Transform Your Business with a Software ERP System
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPT
Introduction Database Management System for Course Database
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms I-SECS-1021-03
Wondershare Filmora 15 Crack With Activation Key [2025
Nekopoi APK 2025 free lastest update
Which alternative to Crystal Reports is best for small or large businesses.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Computer Software and OS of computer science of grade 11.pptx
Softaken Excel to vCard Converter Software.pdf
PTS Company Brochure 2025 (1).pdf.......
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Reimagine Home Health with the Power of Agentic AI​
Introduction to Artificial Intelligence
Transform Your Business with a Software ERP System
CHAPTER 2 - PM Management and IT Context
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 41
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction Database Management System for Course Database
Ad

Clients in control: building demand-driven systems with Om Next