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

Recently uploaded (20)

PDF
Top 10 Project Management Software for Small Teams in 2025.pdf
PPTX
Lesson-3-Operation-System-Support.pptx-I
PDF
How to Write Automated Test Scripts Using Selenium.pdf
PDF
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
PDF
Top AI Tools for Project Managers: My 2025 AI Stack
PDF
IDM Crack Activation Key 2025 Free Download
PDF
10 Mistakes Agile Project Managers Still Make
PDF
How to Set Realistic Project Milestones and Deadlines
PDF
Mobile App for Guard Tour and Reporting.pdf
PDF
Canva Desktop App With Crack Free Download 2025?
PDF
IObit Driver Booster Pro Crack Latest Version Download
PDF
OpenTimelineIO Virtual Town Hall - August 2025
PDF
Difference Between Website and Web Application.pdf
PDF
OpenEXR Virtual Town Hall - August 2025
PPTX
ESDS_SAP Application Cloud Offerings.pptx
PDF
Module 1 - Introduction to Generative AI.pdf
PDF
Coding with GPT-5- What’s New in GPT 5 That Benefits Developers.pdf
PDF
OpenColorIO Virtual Town Hall - August 2025
PDF
C language slides for c programming book by ANSI
Top 10 Project Management Software for Small Teams in 2025.pdf
Lesson-3-Operation-System-Support.pptx-I
How to Write Automated Test Scripts Using Selenium.pdf
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Top AI Tools for Project Managers: My 2025 AI Stack
IDM Crack Activation Key 2025 Free Download
10 Mistakes Agile Project Managers Still Make
How to Set Realistic Project Milestones and Deadlines
Mobile App for Guard Tour and Reporting.pdf
Canva Desktop App With Crack Free Download 2025?
IObit Driver Booster Pro Crack Latest Version Download
OpenTimelineIO Virtual Town Hall - August 2025
Difference Between Website and Web Application.pdf
OpenEXR Virtual Town Hall - August 2025
ESDS_SAP Application Cloud Offerings.pptx
Module 1 - Introduction to Generative AI.pdf
Coding with GPT-5- What’s New in GPT 5 That Benefits Developers.pdf
OpenColorIO Virtual Town Hall - August 2025
C language slides for c programming book by ANSI

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